File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -4,14 +4,21 @@ use code0_flow::flow_config::env_with_default;
44#[ derive( Clone ) ]
55pub struct HttpServerConfig {
66 pub port : u16 ,
7+ pub external_port : u16 ,
78 pub host : String ,
9+ pub external_host : String ,
810}
911
1012impl LoadConfig for HttpServerConfig {
1113 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+
1217 Self {
13- port : env_with_default ( "HTTP_SERVER_PORT" , 8080 ) ,
14- host : env_with_default ( "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) ,
1522 }
1623 }
1724}
Original file line number Diff line number Diff line change @@ -40,17 +40,17 @@ async fn main() {
4040 } ;
4141 log:: info!( "Successfully created runner for http service" ) ;
4242
43- let addr = runner. get_server_config ( ) . port ;
44- let host = runner. get_server_config ( ) . host . clone ( ) ;
43+ let external_addr = runner. get_server_config ( ) . external_port ;
44+ let external_host = runner. get_server_config ( ) . external_host . clone ( ) ;
4545
4646 let configs = vec ! [ ModuleDefinitionAppendix {
4747 module_identifier: String :: from( "draco-rest" ) ,
4848 definitions: vec![ ModuleDefinition {
4949 flow_type_identifier: vec![ String :: from( "REST" ) ] ,
5050 value: Some ( tucana:: shared:: module_definition:: Value :: Endpoint (
5151 Endpoint {
52- host,
53- port: addr as i64 ,
52+ host: external_host ,
53+ port: external_addr as i64 ,
5454 endpoint: String :: from( r"/${{project_slug}}${{httpURL}}" ) ,
5555 } ,
5656 ) ) ,
You can’t perform that action at this time.
0 commit comments