diff options
Diffstat (limited to 'src/util')
-rw-r--r-- | src/util/config.rs | 9 | ||||
-rw-r--r-- | src/util/error.rs | 4 |
2 files changed, 12 insertions, 1 deletions
diff --git a/src/util/config.rs b/src/util/config.rs index cb871562..28349530 100644 --- a/src/util/config.rs +++ b/src/util/config.rs @@ -11,7 +11,6 @@ pub struct Config { pub metadata_dir: PathBuf, pub data_dir: PathBuf, - pub api_bind_addr: SocketAddr, pub rpc_bind_addr: SocketAddr, pub bootstrap_peers: Vec<SocketAddr>, @@ -32,6 +31,8 @@ pub struct Config { pub data_replication_factor: usize, pub rpc_tls: Option<TlsConfig>, + + pub s3_api: ApiConfig, } #[derive(Deserialize, Debug, Clone)] @@ -41,6 +42,12 @@ pub struct TlsConfig { pub node_key: String, } +#[derive(Deserialize, Debug, Clone)] +pub struct ApiConfig { + pub api_bind_addr: SocketAddr, + pub s3_region: String, +} + fn default_max_concurrent_rpc_requests() -> usize { 12 } diff --git a/src/util/error.rs b/src/util/error.rs index f73d6915..cb99cbbc 100644 --- a/src/util/error.rs +++ b/src/util/error.rs @@ -69,6 +69,9 @@ pub enum Error { #[error(display = "Bad request: {}", _0)] BadRequest(String), + #[error(display = "Forbidden: {}", _0)] + Forbidden(String), + #[error(display = "Not found")] NotFound, @@ -84,6 +87,7 @@ impl Error { match self { Error::BadRequest(_) => StatusCode::BAD_REQUEST, Error::NotFound => StatusCode::NOT_FOUND, + Error::Forbidden(_) => StatusCode::FORBIDDEN, Error::RPC(_) => StatusCode::SERVICE_UNAVAILABLE, _ => StatusCode::INTERNAL_SERVER_ERROR, } |