top | item 45438067

(no title)

bertylicious | 5 months ago

This doesn't look like a standard .net config (appsettings.json) to me. It looks more like a simple json serialization of an object. To get the framework behavior that replaces secrets with e.g. env vars one would have to feed this json into a .net ConfigurationBuilder first.

Considering that this represents one of many possible workflow objects (probably organized in a data structure and managed by other objects/methods), implementing secret replacement using a ConfigurationBuilder seems like abuse.

discuss

order

giancarlostoro|5 months ago

> This doesn't look like a standard .net config (appsettings.json) to me.

Having done... enough .NET I don't see a serious consensus and it frustrates me. My favorite was the project that used dot ENV files. I have tried to convince them of it here, but nobody cares enough about the craft I suppose, of course there's more important things to be worked on, momentary change for increased dev experience is not worth it the business.

SideburnsOfDoom|5 months ago

> I don't see a serious consensus and it frustrates me.

If you're saying that there's no one right way to do it, then I broadly disagree. There's the (very flexible) .NET Configuration system (1) - that is the right way to do it. You should start with appsettings.json and other sources, and end up with injecting IOptions<T> into your code. Consistently.

If you're saying that in your experience, far too many people don't use this system, then who am I to disagree with your experience? Sure, it happens. YMMV. I would be insisting that they move to the .NET Configuration system, though. If they're serious.

1) https://learn.microsoft.com/en-us/dotnet/core/extensions/con...

osigurdson|5 months ago

Actually I think .NET config is pretty good. You define a file, which can be overridden by environment variables which in turn can be overridden by command line parameters. Just reading environment variables is fine as well but then you have to do source .env before you run anything (unless you are talking about Python like approach where .env is just another config file essentially).