Description
Running the following command:
docker run --rm -it --name simple-webdav -v /data -p 6060:6060 \
-e WD_PORT=6060 \
-e WD_PREFIX='/dav' \
-e WD_SCOPE='/data' \
-e WD_AUTH='false' \
-e WD_MODIFY='true' \
-e WD_DEBUG='true' \
hacdias/webdav ''
The WD_AUTH and WD_PREFIX seem to be parsed correctly and the problem i experienced was that the WD_MODIFY and WD_SCOPE were not working, after doing some analysis, the problem might occur because the Permission
is nested within Config
, while this works for parsing in the default way with flags and config file, it does not work with environment variables.
Possible solution i tried that might work would be to use something like v.BindEnv("field")
, looking at the tests of the library used for loading configurations, specifically this one: https://github.com/spf13/viper/blob/cc53fac037475edaec5cd2cae73e6c3cc5caef9e/viper_test.go#L967, seems to fix this nesting issue however that feature is still not shipped.
And as it states in their documentation here, that with AutomaticEnv
only loads the value when a v.Get("FIELD")
is called, and they probably do not call it for the nested structures, when they get the keys it only reads the 'outside' values during unmarshaling.
Activity