aboutsummaryrefslogtreecommitdiff
path: root/src/main.rs
diff options
context:
space:
mode:
authorBlackDex <[email protected]>2022-05-25 15:30:23 +0200
committerBlackDex <[email protected]>2022-05-26 09:39:56 +0200
commit40ed505581fdb00fb047637aa3172d52442d5f73 (patch)
tree4a312d0c6b86f58f0d8826ed400560eb99df2a02 /src/main.rs
parentbf0b8d996868a242c4b3a3e5d75367227e0137cd (diff)
downloadvaultwarden-40ed505581fdb00fb047637aa3172d52442d5f73.tar.gz
vaultwarden-40ed505581fdb00fb047637aa3172d52442d5f73.zip
Add a persistent volume check.
This will add a persistent volume check to make sure when running containers someone is using a volume for persistent storage. This check can be bypassed if someone configures `I_REALLY_WANT_VOLATILE_STORAGE=true` as an environment variable. This should prevent issues like #2493 .
Diffstat (limited to 'src/main.rs')
-rw-r--r--src/main.rs14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/main.rs b/src/main.rs
index 00b3d4d8..32257c78 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -276,6 +276,20 @@ fn check_data_folder() {
}
exit(1);
}
+
+ let persistent_volume_check_file = format!("{data_folder}/vaultwarden_docker_persistent_volume_check");
+ let check_file = Path::new(&persistent_volume_check_file);
+ if check_file.exists() && std::env::var("I_REALLY_WANT_VOLATILE_STORAGE").is_err() {
+ error!(
+ "No persistent volume!\n\
+ ########################################################################################\n\
+ # It looks like you did not configure a persistent volume! #\n\
+ # This will result in permanent data loss when the container is removed or updated! #\n\
+ # If you really want to use volatile storage set `I_REALLY_WANT_VOLATILE_STORAGE=true` #\n\
+ ########################################################################################\n"
+ );
+ exit(1);
+ }
}
fn check_rsa_keys() -> Result<(), crate::error::Error> {