goStatic icon indicating copy to clipboard operation
goStatic copied to clipboard

Allow configuration from environment variables

Open deranjer opened this issue 3 years ago • 1 comments

Docker convention tends to encourage environment variables for configuration of container parameters.

I need a 404 for my static sites, so I override the entrypoint with -fallback, but I find this method is extremely rare among docker containers (and not well documented in this project).

Was wondering if you would consider looking at the namsral/flag package for allowing setting parameters from environment variables. The best part is that it appears to be a drop in replacement for the std library flag package.

Per the documentation, cmd line params would always take precedence over environment variables if there was a conflict. As long as it really is a drop-in replacement, there shouldn't be any breaking changes while aligning more closely with Docker standards.

The namsral/flag pkg does also allow loading from a .conf file, but that would require some additional code, and I don't see a need to add that feature at this time.

Let me know what you think.

deranjer avatar Feb 15 '22 03:02 deranjer

I like the idea, feel free to open a PR :smile:

PierreZ avatar Feb 15 '22 07:02 PierreZ