Skip to content

Commit 5bd2267

Browse files
committed
feat: made external use default vars if not present
1 parent a01d6af commit 5bd2267

1 file changed

Lines changed: 7 additions & 4 deletions

File tree

adapter/rest/src/config.rs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,14 @@ pub struct HttpServerConfig {
1111

1212
impl LoadConfig for HttpServerConfig {
1313
fn load() -> Self {
14+
let port = env_with_default("HTTP_SERVER_PORT", 8080);
15+
let host = env_with_default("HTTP_SERVER_HOST", String::from("127.0.0.1"));
16+
1417
Self {
15-
port: env_with_default("HTTP_SERVER_PORT", 8080),
16-
host: env_with_default("HTTP_SERVER_HOST", String::from("127.0.0.1")),
17-
external_port: env_with_default("EXTERNAL_HTTP_SERVER_PORT", 8080),
18-
external_host: env_with_default("EXTERNAL_HTTP_SERVER_HOST", String::from("127.0.0.1")),
18+
host: host.clone(),
19+
port,
20+
external_port: env_with_default("EXTERNAL_HTTP_SERVER_PORT", port),
21+
external_host: env_with_default("EXTERNAL_HTTP_SERVER_HOST", host),
1922
}
2023
}
2124
}

0 commit comments

Comments
 (0)