pub struct ServerConfig {Show 20 fields
pub host: String,
pub port: u16,
pub redis_url: String,
pub config_file_path: String,
pub api_key: SecretString,
pub rate_limit_requests_per_second: u64,
pub rate_limit_burst_size: u32,
pub metrics_port: u16,
pub enable_swagger: bool,
pub redis_connection_timeout_ms: u64,
pub redis_key_prefix: String,
pub rpc_timeout_ms: u64,
pub provider_max_retries: u8,
pub provider_retry_base_delay_ms: u64,
pub provider_retry_max_delay_ms: u64,
pub provider_max_failovers: u8,
pub repository_storage_type: RepositoryStorageType,
pub reset_storage_on_start: bool,
pub storage_encryption_key: Option<SecretString>,
pub transaction_expiration_hours: u64,
}
Fields§
§host: String
The host address the server will bind to.
port: u16
The port number the server will listen on.
redis_url: String
The URL for the Redis instance.
config_file_path: String
The file path to the server’s configuration file.
api_key: SecretString
The API key used for authentication.
rate_limit_requests_per_second: u64
The number of requests allowed per second.
rate_limit_burst_size: u32
The maximum burst size for rate limiting.
metrics_port: u16
The port number for exposing metrics.
enable_swagger: bool
Enable Swagger UI.
redis_connection_timeout_ms: u64
The number of seconds to wait for a Redis connection.
redis_key_prefix: String
The prefix for the Redis key.
rpc_timeout_ms: u64
The number of milliseconds to wait for an RPC response.
provider_max_retries: u8
Maximum number of retry attempts for provider operations.
provider_retry_base_delay_ms: u64
Base delay between retry attempts (milliseconds).
provider_retry_max_delay_ms: u64
Maximum delay between retry attempts (milliseconds).
provider_max_failovers: u8
Maximum number of failovers (switching to different providers).
repository_storage_type: RepositoryStorageType
The type of repository storage to use.
reset_storage_on_start: bool
Flag to force config file processing.
storage_encryption_key: Option<SecretString>
The encryption key for the storage.
transaction_expiration_hours: u64
Transaction expiration time in hours for transactions in final states.
Implementations§
Source§impl ServerConfig
impl ServerConfig
Sourcepub fn from_env() -> Self
pub fn from_env() -> Self
Creates a new ServerConfig
instance from environment variables.
§Panics
This function will panic if the REDIS_URL
or API_KEY
environment
variables are not set, as they are required for the server to function.
§Defaults
HOST
defaults to"0.0.0.0"
.APP_PORT
defaults to8080
.CONFIG_DIR
defaults to"config/config.json"
.RATE_LIMIT_REQUESTS_PER_SECOND
defaults to100
.RATE_LIMIT_BURST_SIZE
defaults to300
.METRICS_PORT
defaults to8081
.PROVIDER_MAX_RETRIES
defaults to3
.PROVIDER_RETRY_BASE_DELAY_MS
defaults to100
.PROVIDER_RETRY_MAX_DELAY_MS
defaults to2000
.PROVIDER_MAX_FAILOVERS
defaults to3
.REPOSITORY_STORAGE_TYPE
defaults to"in_memory"
.TRANSACTION_EXPIRATION_HOURS
defaults to4
.
Sourcepub fn get_redis_url() -> String
pub fn get_redis_url() -> String
Gets the Redis URL from environment variable (panics if not set)
Sourcepub fn get_redis_url_optional() -> Option<String>
pub fn get_redis_url_optional() -> Option<String>
Gets the Redis URL from environment variable or returns None if not set
Sourcepub fn get_config_file_path() -> String
pub fn get_config_file_path() -> String
Gets the config file path from environment variables or default
Sourcepub fn get_api_key() -> SecretString
pub fn get_api_key() -> SecretString
Gets the API key from environment variable (panics if not set or too short)
Sourcepub fn get_api_key_optional() -> Option<SecretString>
pub fn get_api_key_optional() -> Option<SecretString>
Gets the API key from environment variable or returns None if not set or invalid
Sourcepub fn get_rate_limit_requests_per_second() -> u64
pub fn get_rate_limit_requests_per_second() -> u64
Gets the rate limit requests per second from environment variable or default
Sourcepub fn get_rate_limit_burst_size() -> u32
pub fn get_rate_limit_burst_size() -> u32
Gets the rate limit burst size from environment variable or default
Sourcepub fn get_metrics_port() -> u16
pub fn get_metrics_port() -> u16
Gets the metrics port from environment variable or default
Sourcepub fn get_enable_swagger() -> bool
pub fn get_enable_swagger() -> bool
Gets the enable swagger setting from environment variable or default
Sourcepub fn get_redis_connection_timeout_ms() -> u64
pub fn get_redis_connection_timeout_ms() -> u64
Gets the Redis connection timeout from environment variable or default
Sourcepub fn get_redis_key_prefix() -> String
pub fn get_redis_key_prefix() -> String
Gets the Redis key prefix from environment variable or default
Sourcepub fn get_rpc_timeout_ms() -> u64
pub fn get_rpc_timeout_ms() -> u64
Gets the RPC timeout from environment variable or default
Sourcepub fn get_provider_max_retries() -> u8
pub fn get_provider_max_retries() -> u8
Gets the provider max retries from environment variable or default
Sourcepub fn get_provider_retry_base_delay_ms() -> u64
pub fn get_provider_retry_base_delay_ms() -> u64
Gets the provider retry base delay from environment variable or default
Sourcepub fn get_provider_retry_max_delay_ms() -> u64
pub fn get_provider_retry_max_delay_ms() -> u64
Gets the provider retry max delay from environment variable or default
Sourcepub fn get_provider_max_failovers() -> u8
pub fn get_provider_max_failovers() -> u8
Gets the provider max failovers from environment variable or default
Sourcepub fn get_repository_storage_type() -> RepositoryStorageType
pub fn get_repository_storage_type() -> RepositoryStorageType
Gets the repository storage type from environment variable or default
Sourcepub fn get_reset_storage_on_start() -> bool
pub fn get_reset_storage_on_start() -> bool
Gets the reset storage on start setting from environment variable or default
Sourcepub fn get_storage_encryption_key() -> Option<SecretString>
pub fn get_storage_encryption_key() -> Option<SecretString>
Gets the storage encryption key from environment variable or None
Sourcepub fn get_transaction_expiration_hours() -> u64
pub fn get_transaction_expiration_hours() -> u64
Gets the transaction expiration hours from environment variable or default
Trait Implementations§
Source§impl Clone for ServerConfig
impl Clone for ServerConfig
Source§fn clone(&self) -> ServerConfig
fn clone(&self) -> ServerConfig
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreAuto Trait Implementations§
impl !Freeze for ServerConfig
impl RefUnwindSafe for ServerConfig
impl Send for ServerConfig
impl Sync for ServerConfig
impl Unpin for ServerConfig
impl UnwindSafe for ServerConfig
Blanket Implementations§
§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more§impl<D> OwoColorize for D
impl<D> OwoColorize for D
§fn fg<C>(&self) -> FgColorDisplay<'_, C, Self>where
C: Color,
fn fg<C>(&self) -> FgColorDisplay<'_, C, Self>where
C: Color,
§fn bg<C>(&self) -> BgColorDisplay<'_, C, Self>where
C: Color,
fn bg<C>(&self) -> BgColorDisplay<'_, C, Self>where
C: Color,
§fn on_magenta(&self) -> BgColorDisplay<'_, Magenta, Self>
fn on_magenta(&self) -> BgColorDisplay<'_, Magenta, Self>
§fn default_color(&self) -> FgColorDisplay<'_, Default, Self>
fn default_color(&self) -> FgColorDisplay<'_, Default, Self>
§fn on_default_color(&self) -> BgColorDisplay<'_, Default, Self>
fn on_default_color(&self) -> BgColorDisplay<'_, Default, Self>
§fn bright_black(&self) -> FgColorDisplay<'_, BrightBlack, Self>
fn bright_black(&self) -> FgColorDisplay<'_, BrightBlack, Self>
§fn on_bright_black(&self) -> BgColorDisplay<'_, BrightBlack, Self>
fn on_bright_black(&self) -> BgColorDisplay<'_, BrightBlack, Self>
§fn bright_red(&self) -> FgColorDisplay<'_, BrightRed, Self>
fn bright_red(&self) -> FgColorDisplay<'_, BrightRed, Self>
§fn on_bright_red(&self) -> BgColorDisplay<'_, BrightRed, Self>
fn on_bright_red(&self) -> BgColorDisplay<'_, BrightRed, Self>
§fn bright_green(&self) -> FgColorDisplay<'_, BrightGreen, Self>
fn bright_green(&self) -> FgColorDisplay<'_, BrightGreen, Self>
§fn on_bright_green(&self) -> BgColorDisplay<'_, BrightGreen, Self>
fn on_bright_green(&self) -> BgColorDisplay<'_, BrightGreen, Self>
§fn bright_yellow(&self) -> FgColorDisplay<'_, BrightYellow, Self>
fn bright_yellow(&self) -> FgColorDisplay<'_, BrightYellow, Self>
§fn on_bright_yellow(&self) -> BgColorDisplay<'_, BrightYellow, Self>
fn on_bright_yellow(&self) -> BgColorDisplay<'_, BrightYellow, Self>
§fn bright_blue(&self) -> FgColorDisplay<'_, BrightBlue, Self>
fn bright_blue(&self) -> FgColorDisplay<'_, BrightBlue, Self>
§fn on_bright_blue(&self) -> BgColorDisplay<'_, BrightBlue, Self>
fn on_bright_blue(&self) -> BgColorDisplay<'_, BrightBlue, Self>
§fn bright_magenta(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
fn bright_magenta(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
§fn on_bright_magenta(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
fn on_bright_magenta(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
§fn bright_purple(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
fn bright_purple(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
§fn on_bright_purple(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
fn on_bright_purple(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
§fn bright_cyan(&self) -> FgColorDisplay<'_, BrightCyan, Self>
fn bright_cyan(&self) -> FgColorDisplay<'_, BrightCyan, Self>
§fn on_bright_cyan(&self) -> BgColorDisplay<'_, BrightCyan, Self>
fn on_bright_cyan(&self) -> BgColorDisplay<'_, BrightCyan, Self>
§fn bright_white(&self) -> FgColorDisplay<'_, BrightWhite, Self>
fn bright_white(&self) -> FgColorDisplay<'_, BrightWhite, Self>
§fn on_bright_white(&self) -> BgColorDisplay<'_, BrightWhite, Self>
fn on_bright_white(&self) -> BgColorDisplay<'_, BrightWhite, Self>
§fn blink_fast(&self) -> BlinkFastDisplay<'_, Self>
fn blink_fast(&self) -> BlinkFastDisplay<'_, Self>
§fn strikethrough(&self) -> StrikeThroughDisplay<'_, Self>
fn strikethrough(&self) -> StrikeThroughDisplay<'_, Self>
§fn color<Color>(&self, color: Color) -> FgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
fn color<Color>(&self, color: Color) -> FgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
OwoColorize::fg
] or
a color-specific method, such as [OwoColorize::green
], Read more§fn on_color<Color>(&self, color: Color) -> BgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
fn on_color<Color>(&self, color: Color) -> BgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
OwoColorize::bg
] or
a color-specific method, such as [OwoColorize::on_yellow
], Read more