fix: override DATABASE_URL _after_ URL is constructed
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed
This commit is contained in:
parent
e1c475d05a
commit
631849fceb
1 changed files with 9 additions and 9 deletions
|
@ -136,15 +136,6 @@ impl Settings {
|
|||
Err(e) => warn!("couldn't interpret PORT: {}", e),
|
||||
}
|
||||
|
||||
if let Ok(val) = env::var("DATABASE_URL") {
|
||||
let url = Url::parse(&val).expect("couldn't parse Database URL");
|
||||
s = s.set_override("database.url", url.to_string()).unwrap();
|
||||
let database_type = DBType::from_url(&url).unwrap();
|
||||
s = s
|
||||
.set_override("database.database_type", database_type.to_string())
|
||||
.unwrap();
|
||||
}
|
||||
|
||||
let intermediate_config = s.build_cloned().unwrap();
|
||||
|
||||
s = s
|
||||
|
@ -171,6 +162,15 @@ impl Settings {
|
|||
)
|
||||
.expect("Couldn't set database url");
|
||||
|
||||
if let Ok(val) = env::var("DATABASE_URL") {
|
||||
let url = Url::parse(&val).expect("couldn't parse Database URL");
|
||||
s = s.set_override("database.url", url.to_string()).unwrap();
|
||||
let database_type = DBType::from_url(&url).unwrap();
|
||||
s = s
|
||||
.set_override("database.database_type", database_type.to_string())
|
||||
.unwrap();
|
||||
}
|
||||
|
||||
let settings = s.build()?.try_deserialize::<Settings>()?;
|
||||
settings.check_url();
|
||||
|
||||
|
|
Loading…
Reference in a new issue