darkwing::config

Struct DarkwingConfig

source
pub struct DarkwingConfig {
Show 28 fields pub cargo_env: CargoEnv, pub port: u16, pub database_url: String, pub database_connection_pool_size: u32, pub redis_url: String, pub redis_connection_pool_size: u32, pub redis_default_timeout_seconds: u64, pub redis_expiration_seconds: u64, pub jwt_token_public_key: String, pub jwt_token_algorithm: String, pub config_encryption_key: String, pub rate_limit_per_second: u64, pub aws_s3_access_key_id: String, pub aws_s3_secret_access_key: String, pub aws_s3_endpoint: String, pub aws_s3_bucket: String, pub aws_s3_region: String, pub aws_s3_public_url: String, pub aws_s3_backup_access_key_id: String, pub aws_s3_backup_secret_access_key: String, pub aws_s3_backup_endpoint: String, pub aws_s3_backup_bucket: String, pub aws_s3_backup_region: String, pub database_encryption_key_part_1: String, pub database_encryption_key_part_2: String, pub aws_s3_presigned_url_expiration_seconds: u64, pub s3_path_encryption_key: String, pub sentry_dsn: Option<String>,
}
Expand description

Main configuration structure for the Darkwing application.

This struct is populated using command line arguments or environment variables through the clap crate’s derive functionality. Each field corresponds to a configurable aspect of the application.

Fields§

§cargo_env: CargoEnv

The environment in which the application is running

§port: u16

Port number on which the server will listen

§database_url: String

Database connection string

§database_connection_pool_size: u32

Maximum number of connections in the database connection pool

§redis_url: String

Redis server connection string

§redis_connection_pool_size: u32

Maximum number of connections in the Redis connection pool

§redis_default_timeout_seconds: u64

Default timeout for Redis operations in seconds

§redis_expiration_seconds: u64

Time-to-live for Redis cache entries in seconds

§jwt_token_public_key: String

Public key used for JWT token verification

§jwt_token_algorithm: String

Algorithm used for JWT token signing/verification (e.g., “RS256”)

§config_encryption_key: String

Key used for encrypting configuration values

§rate_limit_per_second: u64

Maximum number of requests allowed per second for rate limiting

§aws_s3_access_key_id: String

AWS S3 access key ID for primary storage

§aws_s3_secret_access_key: String

AWS S3 secret access key for primary storage

§aws_s3_endpoint: String

AWS S3 endpoint URL for primary storage

§aws_s3_bucket: String

AWS S3 bucket name for primary storage

§aws_s3_region: String

AWS S3 region for primary storage

§aws_s3_public_url: String

Public URL for accessing S3 objects

§aws_s3_backup_access_key_id: String

AWS S3 access key ID for backup storage

§aws_s3_backup_secret_access_key: String

AWS S3 secret access key for backup storage

§aws_s3_backup_endpoint: String

AWS S3 endpoint URL for backup storage

§aws_s3_backup_bucket: String

AWS S3 bucket name for backup storage

§aws_s3_backup_region: String

AWS S3 region for backup storage

§database_encryption_key_part_1: String

First part of the database encryption key (split for security)

§database_encryption_key_part_2: String

Second part of the database encryption key (split for security)

§aws_s3_presigned_url_expiration_seconds: u64

Expiration time in seconds for S3 presigned URLs

§s3_path_encryption_key: String

Encryption key for S3 path encryption

§sentry_dsn: Option<String>

Optional Sentry DSN for error tracking

Implementations§

source§

impl DarkwingConfig

source

pub fn get_jwt_token_algorithm(&self) -> Result<Algorithm>

Converts the JWT algorithm string to the corresponding Algorithm enum value.

source

pub fn redis_timeout(&self) -> Duration

Returns the Redis timeout duration.

source

pub fn presigned_url_expiration(&self) -> Duration

Returns the expiration duration for presigned URLs.

Trait Implementations§

source§

impl Args for DarkwingConfig

source§

fn group_id() -> Option<Id>

Report the [ArgGroup::id][crate::ArgGroup::id] for this set of arguments
source§

fn augment_args<'b>(__clap_app: Command) -> Command

Append to [Command] so it can instantiate Self via [FromArgMatches::from_arg_matches_mut] Read more
source§

fn augment_args_for_update<'b>(__clap_app: Command) -> Command

Append to [Command] so it can instantiate self via [FromArgMatches::update_from_arg_matches_mut] Read more
source§

impl Clone for DarkwingConfig

source§

fn clone(&self) -> DarkwingConfig

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl CommandFactory for DarkwingConfig

source§

fn command<'b>() -> Command

Build a [Command] that can instantiate Self. Read more
source§

fn command_for_update<'b>() -> Command

Build a [Command] that can update self. Read more
source§

impl Debug for DarkwingConfig

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Default for DarkwingConfig

source§

fn default() -> DarkwingConfig

Returns the “default value” for a type. Read more
source§

impl FromArgMatches for DarkwingConfig

source§

fn from_arg_matches(__clap_arg_matches: &ArgMatches) -> Result<Self, Error>

Instantiate Self from [ArgMatches], parsing the arguments as needed. Read more
source§

fn from_arg_matches_mut( __clap_arg_matches: &mut ArgMatches, ) -> Result<Self, Error>

Instantiate Self from [ArgMatches], parsing the arguments as needed. Read more
source§

fn update_from_arg_matches( &mut self, __clap_arg_matches: &ArgMatches, ) -> Result<(), Error>

Assign values from ArgMatches to self.
source§

fn update_from_arg_matches_mut( &mut self, __clap_arg_matches: &mut ArgMatches, ) -> Result<(), Error>

Assign values from ArgMatches to self.
source§

impl Parser for DarkwingConfig

§

fn parse() -> Self

Parse from std::env::args_os(), [exit][Error::exit] on error.
§

fn try_parse() -> Result<Self, Error>

Parse from std::env::args_os(), return Err on error.
§

fn parse_from<I, T>(itr: I) -> Self
where I: IntoIterator<Item = T>, T: Into<OsString> + Clone,

Parse from iterator, [exit][Error::exit] on error.
§

fn try_parse_from<I, T>(itr: I) -> Result<Self, Error>
where I: IntoIterator<Item = T>, T: Into<OsString> + Clone,

Parse from iterator, return Err on error.
§

fn update_from<I, T>(&mut self, itr: I)
where I: IntoIterator<Item = T>, T: Into<OsString> + Clone,

Update from iterator, [exit][Error::exit] on error. Read more
§

fn try_update_from<I, T>(&mut self, itr: I) -> Result<(), Error>
where I: IntoIterator<Item = T>, T: Into<OsString> + Clone,

Update from iterator, return Err on error.

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

impl<T> Any for T
where T: Any,

§

fn into_any(self: Box<T>) -> Box<dyn Any>

§

fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>

§

fn type_name(&self) -> &'static str

§

impl<T> AnySync for T
where T: Any + Send + Sync,

§

fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Send + Sync>

§

impl<T> ArchivePointee for T

§

type ArchivedMetadata = ()

The archived version of the pointer metadata for this type.
§

fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata

Converts some archived metadata to the pointer metadata for itself.
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> CloneToUninit for T
where T: Clone,

source§

unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> FromRef<T> for T
where T: Clone,

§

fn from_ref(input: &T) -> T

Converts to this type from a reference to the input type.
§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> IntoEither for T

source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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<Unshared, Shared> IntoShared<Shared> for Unshared
where Shared: FromUnshared<Unshared>,

§

fn into_shared(self) -> Shared

Creates a shared type from an unshared type.
§

impl<T> LayoutRaw for T

§

fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>

Returns the layout of the type.
§

impl<T> Pointable for T

§

const ALIGN: usize = _

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
§

impl<T> Pointee for T

§

type Metadata = ()

The metadata type for pointers and references to this type.
source§

impl<T> Same for T

source§

type Output = T

Should always be Self
source§

impl<T> ToOwned for T
where T: Clone,

source§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

source§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more