mirror of
https://github.com/LemmyNet/lemmy.git
synced 2024-11-04 19:50:00 +00:00
Fix overriding config vars with underscore from environment
This commit is contained in:
parent
b7c24a372b
commit
a3065ed39f
2 changed files with 5 additions and 2 deletions
2
README.md
vendored
2
README.md
vendored
|
@ -231,7 +231,7 @@ into your local `config.hjson` file.
|
||||||
|
|
||||||
Additionally, you can override any config files with environment variables. These have the same name as the config
|
Additionally, you can override any config files with environment variables. These have the same name as the config
|
||||||
options, and are prefixed with `LEMMY_`. For example, you can override the `database.password` with
|
options, and are prefixed with `LEMMY_`. For example, you can override the `database.password` with
|
||||||
`LEMMY_DATABASE_PASSWORD=my_password`.
|
`LEMMY__DATABASE__POOL_SIZE=10`.
|
||||||
|
|
||||||
An additional option `LEMMY_DATABASE_URL` is available, which can be used with a PostgreSQL connection string like
|
An additional option `LEMMY_DATABASE_URL` is available, which can be used with a PostgreSQL connection string like
|
||||||
`postgres://lemmy:password@lemmy_db:5432/lemmy`, passing all connection details at once.
|
`postgres://lemmy:password@lemmy_db:5432/lemmy`, passing all connection details at once.
|
||||||
|
|
|
@ -70,7 +70,10 @@ impl Settings {
|
||||||
|
|
||||||
// Add in settings from the environment (with a prefix of LEMMY)
|
// Add in settings from the environment (with a prefix of LEMMY)
|
||||||
// Eg.. `LEMMY_DEBUG=1 ./target/app` would set the `debug` key
|
// Eg.. `LEMMY_DEBUG=1 ./target/app` would set the `debug` key
|
||||||
s.merge(Environment::with_prefix("LEMMY").separator("_"))?;
|
// Note: we need to use double underscore here, because otherwise variables containing
|
||||||
|
// underscore cant be set from environmnet.
|
||||||
|
// https://github.com/mehcode/config-rs/issues/73
|
||||||
|
s.merge(Environment::with_prefix("LEMMY").separator("__"))?;
|
||||||
|
|
||||||
return s.try_into();
|
return s.try_into();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue