Skip to content

Commit d237925

Browse files
committed
changing config to prefer app engines $PORT var
1 parent 7c110be commit d237925

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

server/src/config.rs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,16 @@ impl Config {
2525
/// `.env` file is supported.
2626
pub fn from_env() -> Config {
2727
dotenv().ok();
28+
29+
// Prefer the $PORT variable set by App Engine
30+
let port = dotenv::var("PORT")
31+
.ok()
32+
.and_then(|p| p.parse().ok())
33+
.unwrap_or_else(|| get_env("PORT", 8080u16)); // fallback
34+
2835
Config {
2936
client_url: get_env("CLIENT_URL", "https://beta.solpg.io"),
30-
port: get_env("PORT", 8080u16),
37+
port,
3138
payload_limit: get_env("PAYLOAD_LIMIT", 1024usize * 1024 * 1024),
3239
verbose: get_env("VERBOSE", false),
3340
db_uri: get_env(

0 commit comments

Comments
 (0)