PierreZ / goStatic

A really small static web server for Docker
GNU General Public License v2.0
395 stars 77 forks source link

Allow configuration from environment variables #50

Open deranjer opened 2 years ago

deranjer commented 2 years ago

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.

PierreZ commented 2 years ago

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