mirror of
https://github.com/rustmailer/bichon.git
synced 2026-08-03 07:48:34 +02:00
chore: default to binding 0.0.0.0 and support binding IPv6 addresses.
This commit is contained in:
Vendored
+1
-1
@@ -28,7 +28,7 @@ BICHON_ROOT_DIR=/data/bichon-data
|
|||||||
# Enable API access token validation
|
# Enable API access token validation
|
||||||
BICHON_ENABLE_ACCESS_TOKEN=false
|
BICHON_ENABLE_ACCESS_TOKEN=false
|
||||||
|
|
||||||
# IP address to bind the HTTP and gRPC servers to (default: ::)
|
# IP address to bind the HTTP servers to (default: 0.0.0.0)
|
||||||
BICHON_BIND_IP=
|
BICHON_BIND_IP=
|
||||||
|
|
||||||
# Comma-separated list of allowed CORS origins (e.g. https://app.example.com)
|
# Comma-separated list of allowed CORS origins (e.g. https://app.example.com)
|
||||||
@@ -51,7 +51,7 @@ pub type ApiResult<T, E = ApiErrorResponse> = std::result::Result<T, E>;
|
|||||||
|
|
||||||
pub async fn start_http_server() -> BichonResult<()> {
|
pub async fn start_http_server() -> BichonResult<()> {
|
||||||
let listener = TcpListener::bind((
|
let listener = TcpListener::bind((
|
||||||
SETTINGS.bichon_bind_ip.clone().unwrap_or("::".into()),
|
SETTINGS.bichon_bind_ip.clone().unwrap_or("0.0.0.0".into()),
|
||||||
SETTINGS.bichon_http_port as u16,
|
SETTINGS.bichon_http_port as u16,
|
||||||
));
|
));
|
||||||
|
|
||||||
|
|||||||
@@ -50,8 +50,8 @@ pub struct Settings {
|
|||||||
#[clap(
|
#[clap(
|
||||||
long,
|
long,
|
||||||
env,
|
env,
|
||||||
default_value = "::",
|
default_value = "0.0.0.0",
|
||||||
help = "The IP address that the node binds to, in IPv4 or IPv6 format (e.g., 192.168.1.1 or ::1). Required in cluster mode.",
|
help = "The IP address that the node binds to, in IPv4 or IPv6 format (e.g., 192.168.1.1 or ::1).",
|
||||||
value_parser = ValueParser::new(|s: &str| {
|
value_parser = ValueParser::new(|s: &str| {
|
||||||
// Ensure the input is a valid IPv4 or IPv6 address
|
// Ensure the input is a valid IPv4 or IPv6 address
|
||||||
if s.parse::<std::net::Ipv4Addr>().is_err() && s.parse::<std::net::Ipv6Addr>().is_err() {
|
if s.parse::<std::net::Ipv4Addr>().is_err() && s.parse::<std::net::Ipv6Addr>().is_err() {
|
||||||
|
|||||||
Reference in New Issue
Block a user