pub struct ServerConfig {
pub bind: SocketAddr,
pub storage_backend: StorageBackend,
pub sqlite_path: Option<PathBuf>,
pub postgres_url: Option<String>,
pub api_keys: Vec<(String, Role)>,
pub jwt: Option<JwtConfig>,
pub cors: bool,
pub timeout_seconds: u64,
}Expand description
Server configuration.
Fields§
§bind: SocketAddrBind address (e.g., “0.0.0.0:8080”)
storage_backend: StorageBackendStorage backend type
sqlite_path: Option<PathBuf>SQLite database path (when storage_backend is Sqlite)
postgres_url: Option<String>PostgreSQL connection URL (when storage_backend is Postgres)
api_keys: Vec<(String, Role)>API keys for authentication (key -> role mapping)
jwt: Option<JwtConfig>Optional JWT validation settings.
cors: boolEnable CORS for all origins
timeout_seconds: u64Request timeout in seconds
Implementations§
Source§impl ServerConfig
impl ServerConfig
Sourcepub fn storage_backend(self, backend: StorageBackend) -> Self
pub fn storage_backend(self, backend: StorageBackend) -> Self
Sets the storage backend.
Sourcepub fn sqlite_path(self, path: impl Into<PathBuf>) -> Self
pub fn sqlite_path(self, path: impl Into<PathBuf>) -> Self
Sets the SQLite database path.
Sourcepub fn postgres_url(self, url: impl Into<String>) -> Self
pub fn postgres_url(self, url: impl Into<String>) -> Self
Sets the PostgreSQL connection URL.
Trait Implementations§
Source§impl Clone for ServerConfig
impl Clone for ServerConfig
Source§fn clone(&self) -> ServerConfig
fn clone(&self) -> ServerConfig
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ServerConfig
impl Debug for ServerConfig
Auto Trait Implementations§
impl Freeze for ServerConfig
impl RefUnwindSafe for ServerConfig
impl Send for ServerConfig
impl Sync for ServerConfig
impl Unpin for ServerConfig
impl UnsafeUnpin for ServerConfig
impl UnwindSafe for ServerConfig
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more