environment variables do not override file-based configuration
tmbrwn opened this issue · 2 comments
Bug: environment variables are overridden by file-based configuration
Current Behavior
GoTrue will ignore any parameters passed in through the environment if the same parameter is specified in a .env
file as well. This is contrary to the documentation, which states that environment variables take precedence over file-based configuration.
The issue appears to be due to gobuffalo/envy#36. Envy is a dependency of github.com/gobuffalo/pop, which is a dependency of this project.
Workarounds
The issue with envy applies to any parameters specified in a file called .env
. If no such file exists, and any configuration is done with another file and referenced with gotrue -c some-other-config-file
, then configuration will function as intended.
Steps to Reproduce
.env
GOTRUE_SITE_URL=someurl.com
GOTRUE_DISABLE_SIGNUP=false
GOTRUE_OPERATOR_TOKEN=bogustoken
GOTRUE_API_HOST=0.0.0.0
GOTRUE_API_PORT=8082
GOTRUE_DB_DRIVER=mysql
GOTRUE_DB_DATABASE_URL=root@tcp(localhost:3306)/gotrue_development?multiStatements=true&parseTime=true
GOTRUE_JWT_SECRET=itsnosecret
GOTRUE_JWT_EXP=3600
(the content of the .env
is not too important but this is an example with all required parameters set)
Invocation:
GOTRUE_DB_DATABASE_URL=root@tcp(someotherhost:3306)/gotrue_development?multiStatements=true&parseTime=true ./gotrue
Result:
GoTrue attempts to reach the database at localhost:3306
rather than someotherhost:3306
.
(built using go1.16.3 darwin/amd64
)
This issue has been automatically marked as stale because it has not had activity in 1 year. It will be closed in 7 days if no further activity occurs. Thanks!
This issue was closed because it had no activity for over 1 year.