commit 94201ca133c190811eaf61880f6c707f9c5fa36c
parent 99f9e7252aa1da582b029577b4af461973ad3bf7
Author: Daniel GarcĂa <dani-garcia@users.noreply.github.com>
Date: Sun, 27 Feb 2022 21:21:38 +0100
Merge branch 'custom-env-path' of https://github.com/TinfoilSubmarine/vaultwarden into TinfoilSubmarine-custom-env-path
Diffstat:
2 files changed, 6 insertions(+), 1 deletion(-)
diff --git a/.env.template b/.env.template
@@ -3,6 +3,11 @@
##
## Be aware that most of these settings will be overridden if they were changed
## in the admin interface. Those overrides are stored within DATA_FOLDER/config.json .
+##
+## By default, vaultwarden expects for this file to be named ".env" and located
+## in the current working directory. If this is not the case, the environment
+## variable ENV_FILE can be set to the location of this file prior to starting
+## vaultwarden.
## Main data folder
# DATA_FOLDER=data
diff --git a/src/config.rs b/src/config.rs
@@ -56,7 +56,7 @@ macro_rules! make_config {
impl ConfigBuilder {
#[allow(clippy::field_reassign_with_default)]
fn from_env() -> Self {
- match dotenv::from_path(".env") {
+ match dotenv::from_path(get_env("ENV_FILE").unwrap_or_else(|| String::from(".env"))) {
Ok(_) => (),
Err(e) => match e {
dotenv::Error::LineParse(msg, pos) => {