Let me still use env to turn off auth completely while still passing setup()
drdamour opened this issue · 3 comments
locally, because there's no easy auth i want to turn off auth so i had to resort to something like this
DfmEndpoint.Setup(
new DfmSettings(){
AllowedAppRoles = new[]{ AuthUtils.RoleITMaint },
Mode = DfmMode.Normal,
#if DEBUG
DisableAuthentication = true,
#endif
}
);
i was hoping i could skip out on the auth setting and still provide
"DFM_NONCE": "i_sure_know_what_i_am_doing",
in my local settings and have auth off...but it behaves strangely with auth failures still. It'd be great to turn off auth when running local with just local.settings.json since they never get applied when i deploy to cloud.
suggestions?
i also thought of doing this myself with some Environment.Get(var) != off or whatever, but be nice if it was OOTB
When called with a parameter, DfmEndpoint.Setup()
overshadows config settings. It's done like that deliberately - to reduce confusion.
So you either call it without parameter (then config settings/env variables take effect) or add your own custom logic, e.g.
DisableAuthentication = Environment.GetEnvironmentVariable("DFM_NONCE") == "i_sure_know_what_i_am_doing"
i get it's deliberate but it's kinda strange and would be nicer if it wasn't that way IMO
not sure if you can get your settings/options from DI but if you could then it would allow dual env/code config if you bound early to env then devs coul
builder.Services.Configure(
options => { //whatever they wanna override}
)