Skip to content

Commit dbd1efb

Browse files
committed
feat: added new env variable to switch between http & https
1 parent d57115a commit dbd1efb

2 files changed

Lines changed: 8 additions & 0 deletions

File tree

adapter/rest/src/config.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ pub struct HttpServerConfig {
77
pub external_port: u16,
88
pub host: String,
99
pub external_host: String,
10+
pub https_configured: bool
1011
}
1112

1213
impl LoadConfig for HttpServerConfig {
@@ -19,6 +20,7 @@ impl LoadConfig for HttpServerConfig {
1920
port,
2021
external_port: env_with_default("EXTERNAL_HTTP_SERVER_PORT", port),
2122
external_host: env_with_default("EXTERNAL_HTTP_SERVER_HOST", host),
23+
https_configured: env_with_default("HTTPS_CONFIGURED", false),
2224
}
2325
}
2426
}

adapter/rest/src/main.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,11 @@ async fn main() {
3333
let external_addr = runner.get_server_config().external_port;
3434
let external_host = runner.get_server_config().external_host.clone();
3535

36+
let protocol = match runner.get_server_config().https_configured {
37+
true => String::from("https"),
38+
false => String::from("http"),
39+
};
40+
3641
let configs = vec![ModuleDefinitionAppendix {
3742
module_identifier: String::from("draco-rest"),
3843
definitions: vec![ModuleDefinition {
@@ -42,6 +47,7 @@ async fn main() {
4247
host: external_host,
4348
port: external_addr as i64,
4449
endpoint: String::from(r"/${{project_slug}}${{httpURL}}"),
50+
protocol: protocol
4551
},
4652
)),
4753
}],

0 commit comments

Comments
 (0)