For easy deployment of the docker image it would be great to allow the config.json file to be generated from environment variables upon start.
Another alternative, that the code itself checks if certain environment variables are defined and then fallback to the config.json (that is a pattern widely used AFAIK). Depending on all the configuration options this might be even a better approach than expanding a template to a .json.
Thanks for the great project!
@bcardiff, @veteran29, @davidpelayo, @derekoharrow, this is now merged in master, along with other enhancements (#506). It will be available in the next release.
You can see implementation details in #504 -> #506. See also spf13/viper#working-with-environment-variables and precedence.
Probably it's on its way, but is hard to know the allowed config options. Between #504 and #506 I am a bit lost what is the current rule to map "some.config" to an env variable. Is it FB_SOME_CONFIG/FB_SOME__CONFIG/FB_SOME.CONFIG/FB_some.config? I am not used to the codebase and packages used. From a user perspective knowing the convention will be really helpful.
Thanks for resolving the issue and keep developing FB. I will eagerly wait for the next release.
The relevant lines, which were introduced in #506, are cli/cmd/root.go#L65-L67. Note that it is the same as #504/files, with an additional replacement. Therefore the format is:
FB_.. with _.The first of the options you commented is correct: FB_SOME_CONFIG.
Anyway, note that flags take precedence over environment variables. Values in the config file do not. E.g.:
$ docker run --rm -it -p 5566:1234 -e FB_PORT=1234 -e FB_AUTH_METHOD=none filebrowser/filebrowser
2018/08/23 00:34:16 Using config file: /.filebrowser.json
2018/08/23 00:34:16 Listening on [::]:1234
$ docker run --rm -it -p 5566:1234 -e FB_PORT=8888 -e FB_AUTH_METHOD=none filebrowser/filebrowser -p 1234
2018/08/23 00:35:24 Using config file: /.filebrowser.json
2018/08/23 00:35:24 Listening on [::]:1234
Last, filebrowser/filebrowser:latest is now updated with each commit pushed to master (so it is a 'rolling' development image). Then, if you are using docker (and not caddy), you can already try this feature. Indeed, it would help us find possible bugs if you tried envvars that we have not tested yet.
Probably it's on its way, but is hard to know the allowed config options.
It is not (yet). So, feel free to contribute by opening either an issue or a PR in filebrowser/filebrowser.github.io.
Most helpful comment
@bcardiff, @veteran29, @davidpelayo, @derekoharrow, this is now merged in master, along with other enhancements (#506). It will be available in the next release.
You can see implementation details in #504 -> #506. See also spf13/viper#working-with-environment-variables and precedence.