I tried to containerize a simple webapp, but was having issues with the host being hard coded to 127.0.0.1.
I resolved the issue by adding an environment variable ROC_BASIC_WEBSERVER_HOST that I set to 0.0.0.0 and used it like:
let host = env::var(HOST_ENV_NAME).unwrap_or("127.0.0.1".to_string());
let addr = format!("{}:{}", host, port).parse::<SocketAddr>().expect("Failed to parse host and port");
If this is an acceptable solution I'll make a PR, and I could add some more variables like PORT.
I tried to containerize a simple webapp, but was having issues with the host being hard coded to
127.0.0.1
.I resolved the issue by adding an environment variable
ROC_BASIC_WEBSERVER_HOST
that I set to0.0.0.0
and used it like:If this is an acceptable solution I'll make a PR, and I could add some more variables like PORT.
Otherwise, I'd love to hear it :)