Closed stevekirks closed 3 years ago
That's great - thanks Steve! Will check this out ASAP 👍
For the Config command, I've changed it so it only reads from the config file (env vars aren't loaded). More what the user expects? (https://github.com/datalust/seq-forwarder/pull/57/commits/6744940073e539f447dada64911befefe4702caf)
Looks great, thanks Steve 👍
Hi Nick
I've had a go at implementing Environment Variables for the config. Hopefully it's what you had in mind but you may have a better strategy. Here's some explanations for the pull request;
Example Environment Variable names:
FORWARDER_OUTPUT_RAWPAYLOADLIMITBYTES
FORWARDER_DIAGNOSTICS_INTERNALLOGGINGLEVEL
Its using the
Microsoft.Extensions.Configuration.ConfigurationBuilder
to load the Environment Variables and theGetValue()
method to get each variable the right type.Its renamed property
EncodedApiKey
toApiKey
so that the environment variableFORWARDER_OUTPUT_APIKEY
would match. (Also updated the check that excludes it inConfigCommand
).With these changes, the Config command lists the config file with environment variables overwritten, and writes update the config file with any changes as well as any overwritten environment variables. Not sure if that is the expectation.
If you have ideas for improvement I'm all ears. If you think a different way would be better that's ok too.
Addresses #55