C
C#2y ago
gio735

✅ IServiceCollection.Confgure<> not working

In first line it's properly building JWTConfiguration instance, but for some reason it seems to be unable in below one as DI doesn't work in controller. Don't want to use singleton as it will make me unable to modify secret in middle. Was unable to find if by any chance there is different method to pick configuration from secret.json as well
8 Replies
phaseshift
phaseshift2y ago
Why would you be using builder in controller
gio735
gio735OP2y ago
I am not
phaseshift
phaseshift2y ago
Use IOptions
gio735
gio735OP2y ago
oh totally forgot about that thank you
phaseshift
phaseshift2y ago
And there are snapshot variants that watch for changes as well
gio735
gio735OP2y ago
that would be if I added JWTConfiguration as scoped and did make such constructor for it?
pox
pox2y ago
Options pattern - .NET
Learn the options pattern to represent groups of related settings in .NET apps. The options pattern uses classes to provide strongly-typed access to settings.
gio735
gio735OP2y ago
thank you
Want results from more Discord servers?
Add your server