From 8295688bed720c8f0b5a7bfb9b0e0586463a1004 Mon Sep 17 00:00:00 2001 From: Joel Beckmeyer Date: Wed, 16 Feb 2022 09:25:37 -0500 Subject: [PATCH 1/2] Add support for custom .env file path --- src/config.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/config.rs b/src/config.rs index 9e1f5e56..bd89509d 100644 --- 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) => { From c59a7f4a8cb5d2c2cd03e82ca909eb753303fb0b Mon Sep 17 00:00:00 2001 From: Joel Beckmeyer Date: Wed, 16 Feb 2022 14:42:12 -0500 Subject: [PATCH 2/2] document ENV_FILE variable usage --- .env.template | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.env.template b/.env.template index 8da88cdc..5bc3d047 100644 --- 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