Add response_timeout_seconds config
This commit is contained in:
parent
181ea4faef
commit
9a0b8a07bf
5 changed files with 29 additions and 28 deletions
1
backend/Cargo.lock
generated
1
backend/Cargo.lock
generated
|
|
@ -2803,6 +2803,7 @@ dependencies = [
|
||||||
"http-body",
|
"http-body",
|
||||||
"http-body-util",
|
"http-body-util",
|
||||||
"pin-project-lite",
|
"pin-project-lite",
|
||||||
|
"tokio",
|
||||||
"tower-layer",
|
"tower-layer",
|
||||||
"tower-service",
|
"tower-service",
|
||||||
"tracing",
|
"tracing",
|
||||||
|
|
|
||||||
|
|
@ -1,23 +1,24 @@
|
||||||
database:
|
database:
|
||||||
databases_directory_path: databases
|
databases_directory_path: databases
|
||||||
max_connections_per_vault: 12
|
max_connections_per_vault: 12
|
||||||
|
|
||||||
server:
|
server:
|
||||||
host: 0.0.0.0
|
host: 0.0.0.0
|
||||||
port: 3000
|
port: 3000
|
||||||
max_body_size_mb: 512
|
max_body_size_mb: 512
|
||||||
max_clients_per_vault: 256
|
max_clients_per_vault: 256
|
||||||
|
response_timeout_seconds: 60
|
||||||
|
|
||||||
users:
|
users:
|
||||||
user_tokens:
|
user_tokens:
|
||||||
- name: admin
|
- name: admin
|
||||||
token: test-token-change-me
|
token: test-token-change-me
|
||||||
vault_access:
|
vault_access:
|
||||||
type: allow_access_to_all
|
type: allow_access_to_all
|
||||||
|
|
||||||
- name: test
|
- name: test
|
||||||
token: other-test-token
|
token: other-test-token
|
||||||
vault_access:
|
vault_access:
|
||||||
type: allow_list
|
type: allow_list
|
||||||
allowed:
|
allowed:
|
||||||
- default
|
- default
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,7 @@ axum = { version = "0.7.4", features = ["ws", "macros", "tracing", "multipart"]}
|
||||||
axum-extra = { version = "0.9.6", features = ["typed-header"] }
|
axum-extra = { version = "0.9.6", features = ["typed-header"] }
|
||||||
aide-axum-typed-multipart = "0.13.0"
|
aide-axum-typed-multipart = "0.13.0"
|
||||||
axum_typed_multipart = "0.11.0"
|
axum_typed_multipart = "0.11.0"
|
||||||
tower-http = { version = "0.6.1", features = ["cors", "trace", "limit"] }
|
tower-http = { version = "0.6.1", features = ["cors", "trace", "limit", "timeout"] }
|
||||||
tracing-subscriber = { version = "0.3.19", features = ["fmt", "env-filter"]}
|
tracing-subscriber = { version = "0.3.19", features = ["fmt", "env-filter"]}
|
||||||
serde_yaml = "0.9.34"
|
serde_yaml = "0.9.34"
|
||||||
sqlx = { version = "0.8.3", features = ["sqlite", "runtime-tokio", "uuid", "chrono"] }
|
sqlx = { version = "0.8.3", features = ["sqlite", "runtime-tokio", "uuid", "chrono"] }
|
||||||
|
|
|
||||||
|
|
@ -3,9 +3,10 @@ use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
use crate::consts::{
|
use crate::consts::{
|
||||||
DEFAULT_HOST, DEFAULT_MAX_BODY_SIZE_MB, DEFAULT_MAX_CLIENTS_PER_VAULT, DEFAULT_PORT,
|
DEFAULT_HOST, DEFAULT_MAX_BODY_SIZE_MB, DEFAULT_MAX_CLIENTS_PER_VAULT, DEFAULT_PORT,
|
||||||
|
DEFAULT_RESPONSE_TIMEOUT_SECONDS,
|
||||||
};
|
};
|
||||||
|
|
||||||
#[derive(Debug, Deserialize, Serialize, Clone)]
|
#[derive(Debug, Deserialize, Serialize, Clone, Default)]
|
||||||
pub struct ServerConfig {
|
pub struct ServerConfig {
|
||||||
#[serde(default = "default_host")]
|
#[serde(default = "default_host")]
|
||||||
pub host: String,
|
pub host: String,
|
||||||
|
|
@ -18,6 +19,9 @@ pub struct ServerConfig {
|
||||||
|
|
||||||
#[serde(default = "default_max_clients_per_vault")]
|
#[serde(default = "default_max_clients_per_vault")]
|
||||||
pub max_clients_per_vault: usize,
|
pub max_clients_per_vault: usize,
|
||||||
|
|
||||||
|
#[serde(default = "default_response_timeout_seconds")]
|
||||||
|
pub response_timeout_seconds: u64,
|
||||||
}
|
}
|
||||||
|
|
||||||
fn default_host() -> String {
|
fn default_host() -> String {
|
||||||
|
|
@ -40,13 +44,7 @@ fn default_max_clients_per_vault() -> usize {
|
||||||
DEFAULT_MAX_CLIENTS_PER_VAULT
|
DEFAULT_MAX_CLIENTS_PER_VAULT
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Default for ServerConfig {
|
fn default_response_timeout_seconds() -> u64 {
|
||||||
fn default() -> Self {
|
debug!("Using default response timeout (seconds): {DEFAULT_RESPONSE_TIMEOUT_SECONDS}");
|
||||||
Self {
|
DEFAULT_RESPONSE_TIMEOUT_SECONDS
|
||||||
host: default_host(),
|
|
||||||
port: default_port(),
|
|
||||||
max_body_size_mb: default_max_body_size_mb(),
|
|
||||||
max_clients_per_vault: default_max_clients_per_vault(),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -4,4 +4,5 @@ pub const DEFAULT_HOST: &str = "127.0.0.1";
|
||||||
pub const DEFAULT_PORT: u16 = 3000;
|
pub const DEFAULT_PORT: u16 = 3000;
|
||||||
pub const DEFAULT_MAX_CONNECTIONS_PER_VAULT: u32 = 12;
|
pub const DEFAULT_MAX_CONNECTIONS_PER_VAULT: u32 = 12;
|
||||||
pub const DEFAULT_MAX_BODY_SIZE_MB: usize = 4096;
|
pub const DEFAULT_MAX_BODY_SIZE_MB: usize = 4096;
|
||||||
|
pub const DEFAULT_RESPONSE_TIMEOUT_SECONDS: u64 = 60;
|
||||||
pub const DEFAULT_MAX_CLIENTS_PER_VAULT: usize = 256;
|
pub const DEFAULT_MAX_CLIENTS_PER_VAULT: usize = 256;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue