Skip to content

Commit 3a7fdb1

Browse files
committed
fix(db): database_url var was set at compile time.
1 parent 0992eea commit 3a7fdb1

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/core/settings/mod.rs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,12 @@ impl Settings {
3535
// These env vars are automatically set by Heroku
3636
// DATABASE_URL is also used by SQLx and is required a compile time to check SQL
3737
// Just simpler this way...
38-
env::set_var(
39-
"APP_DATABASE__DATABASE_URL",
40-
env!("DATABASE_URL", "DATABASE_URL was not set"),
41-
);
38+
39+
match env::var("DATABASE_URL") {
40+
Ok(database_url) => env::set_var("APP_DATABASE__DATABASE_URL", database_url),
41+
Err(_e) => (),
42+
}
43+
4244
// Same thing heroku mandates using the port at $PORT
4345
match env::var("PORT") {
4446
Ok(port) => env::set_var("APP_HTTP__PORT", port),

0 commit comments

Comments
 (0)