Fix: real secret instead of censored in .env
This commit is contained in:
parent
ce315c429c
commit
322c867e94
@ -208,7 +208,7 @@ impl ServerConfig {
|
|||||||
"# If it is changed all existing passwords are invalid.\n"
|
"# If it is changed all existing passwords are invalid.\n"
|
||||||
)
|
)
|
||||||
.to_owned(),
|
.to_owned(),
|
||||||
format!("PSLINK_SECRET=\"{}\"\n", self.secret),
|
format!("PSLINK_SECRET=\"{}\"\n", self.secret.secret),
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -55,10 +55,25 @@ fn test_generate_env() {
|
|||||||
assert!(dbfile.exists(), "No database-file was created!");
|
assert!(dbfile.exists(), "No database-file was created!");
|
||||||
|
|
||||||
let envfile = std::fs::File::open(envfile).unwrap();
|
let envfile = std::fs::File::open(envfile).unwrap();
|
||||||
let mut envcontent = std::io::BufReader::new(envfile).lines();
|
let envcontent: Vec<Result<String, _>> = std::io::BufReader::new(envfile).lines().collect();
|
||||||
assert!(
|
assert!(
|
||||||
envcontent.any(|s| s.as_ref().unwrap().starts_with("PSLINK_PORT=")),
|
envcontent
|
||||||
"Failed to find DATABASE_URL in the generated .env file."
|
.iter()
|
||||||
|
.any(|s| s.as_ref().unwrap().starts_with("PSLINK_PORT=")),
|
||||||
|
"Failed to find PSLINK_PORT in the generated .env file."
|
||||||
|
);
|
||||||
|
assert!(
|
||||||
|
envcontent
|
||||||
|
.iter()
|
||||||
|
.any(|s| s.as_ref().unwrap().starts_with("PSLINK_SECRET=")),
|
||||||
|
"Failed to find PSLINK_SECRET in the generated .env file."
|
||||||
|
);
|
||||||
|
assert!(
|
||||||
|
!envcontent.iter().any(|s| {
|
||||||
|
let r = s.as_ref().unwrap().contains("***SECRET***");
|
||||||
|
r
|
||||||
|
}),
|
||||||
|
"It seems that a censored secret was used in the .env file."
|
||||||
);
|
);
|
||||||
let output = test_bin::get_test_bin("pslink")
|
let output = test_bin::get_test_bin("pslink")
|
||||||
.args(&["generate-env"])
|
.args(&["generate-env"])
|
||||||
|
Loading…
Reference in New Issue
Block a user