Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A single command line argument overrides all the defaults #309

Closed
eine opened this issue Dec 27, 2017 · 1 comment
Closed

A single command line argument overrides all the defaults #309

eine opened this issue Dec 27, 2017 · 1 comment

Comments

@eine
Copy link
Contributor

eine commented Dec 27, 2017

This issue is split from #302.

1. Have you downloaded File Manager from caddyserver.com? If yes, when have you done that? If no, and you are running a custom build, which is the revision of File Manager's repository?

No. I am using the 'vanilla' docker image: hacdias/filemanager.

3. What are you trying to do? and 4. What did you expect to see?

I am trying to set a single command line argument, but keep default values for every other parameter. I'd expect that changing a single argument won't affect any other.

5. What did you see instead (give full error messages and/or log)? and 6. How can someone who is starting from scratch reproduce this behaviour as minimally as possible?

For example, although the default port is 80, setting --no-auth produces an apparently random port number:

$ docker run --rm -itv $(pwd):/srv -p 80:80 hacdias/filemanager
Listening on [::]:80
^C
$ docker run --rm -itv $(pwd):/srv -p 80:80 hacdias/filemanager --no-auth
Listening on [::]:34665
^C
$ docker run --rm -itv $(pwd):/srv -p 80:80 hacdias/filemanager --no-auth
Listening on [::]:42178

Workaround:

$ docker run --rm -itv $(pwd):/srv -p 80:80 hacdias/filemanager --no-auth -p 80

However, this does not happen with ports only:

filemanager_defaults


hacdias
I have to check this to see what's going on. Not sure if it's caused by Viper or something I've done wrong but I don't remember having any issues with that.

@eine
Copy link
Contributor Author

eine commented Apr 17, 2018

@hacdias, I found the bug. Not easy to spot, but straightforward to be fixed. There is absolutely nothing wrong with the golang codebase, and viper works just as expected. The point is that the name of the config file included in the Dockerfile does not match the default config name in setupViper:

Because the config in the Dockerfile is set with CMD, if docker run is executed with any argument after the image name, the CMD is overwritten. As a result, without a -c flag, filebrowser defaults to filebrowser.json, which does not exist inside the container.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant