Add support for binding to unix domain sockets #640

Merged
lx merged 6 commits from networkException/garage:unix-sockets into main 2023-10-03 16:23:02 +00:00
Showing only changes of commit 7353038a64 - Show all commits

View file

@ -7,6 +7,7 @@ use std::path::PathBuf;
use serde::{de, Deserialize}; use serde::{de, Deserialize};
use crate::error::Error; use crate::error::Error;
use crate::socket_address::UnixOrTCPSocketAddress;
/// Represent the whole configuration /// Represent the whole configuration
#[derive(Deserialize, Debug, Clone)] #[derive(Deserialize, Debug, Clone)]
@ -102,7 +103,7 @@ pub struct Config {
#[derive(Deserialize, Debug, Clone)] #[derive(Deserialize, Debug, Clone)]
pub struct S3ApiConfig { pub struct S3ApiConfig {
/// Address and port to bind for api serving /// Address and port to bind for api serving
pub api_bind_addr: Option<SocketAddr>, pub api_bind_addr: Option<UnixOrTCPSocketAddress>,
/// S3 region to use /// S3 region to use
pub s3_region: String, pub s3_region: String,
/// Suffix to remove from domain name to find bucket. If None, /// Suffix to remove from domain name to find bucket. If None,
@ -114,14 +115,14 @@ pub struct S3ApiConfig {
#[derive(Deserialize, Debug, Clone)] #[derive(Deserialize, Debug, Clone)]
pub struct K2VApiConfig { pub struct K2VApiConfig {
/// Address and port to bind for api serving /// Address and port to bind for api serving
pub api_bind_addr: SocketAddr, pub api_bind_addr: UnixOrTCPSocketAddress,
} }
/// Configuration for serving files as normal web server /// Configuration for serving files as normal web server
#[derive(Deserialize, Debug, Clone)] #[derive(Deserialize, Debug, Clone)]
pub struct WebConfig { pub struct WebConfig {
/// Address and port to bind for web serving /// Address and port to bind for web serving
pub bind_addr: SocketAddr, pub bind_addr: UnixOrTCPSocketAddress,
/// Suffix to remove from domain name to find bucket /// Suffix to remove from domain name to find bucket
pub root_domain: String, pub root_domain: String,
} }
@ -130,7 +131,7 @@ pub struct WebConfig {
#[derive(Deserialize, Debug, Clone, Default)] #[derive(Deserialize, Debug, Clone, Default)]
pub struct AdminConfig { pub struct AdminConfig {
/// Address and port to bind for admin API serving /// Address and port to bind for admin API serving
pub api_bind_addr: Option<SocketAddr>, pub api_bind_addr: Option<UnixOrTCPSocketAddress>,
/// Bearer token to use to scrape metrics /// Bearer token to use to scrape metrics
pub metrics_token: Option<String>, pub metrics_token: Option<String>,