Struct CoreConfig

Source
pub struct CoreConfig {
Show 13 fields pub label: String, pub server_address: String, pub server_password_salt: Vec<u8>, pub api_config: TlsConfig, pub db_conn_type: String, pub db_username: String, pub db_password: String, pub db_address: String, pub db_name: String, pub db_config: TlsConfig, pub encoding_key_bytes: Vec<u8>, pub decoding_key_bytes: Vec<u8>, pub kafka_publish_events: bool,
}
Expand description

CoreConfig

The server configuration struct for connectivity and commonly-accessed statics (password salt, jwt encoding/decoding keys, tls configurations using TlsConfig for the api, kafka publishable events flag, and postgres endpoint and credentials).

§Supported Environment Variables

Configure the server configuration CoreConfig with the environment variables and defaults

§Server - Api Threadpool

§Change the server listening address and port

export API_ENDPOINT="0.0.0.0:3000"

§Server - Postgres Threadpool

§Change the postgres database address and port

export POSTGRES_ENDPOINT="0.0.0.0:5432"

§Change the postgres user credentials

export POSTGRES_USERNAME="postgres"
export POSTGRES_PASSWORD="postgres"

§Change the postgres database name

export DB_NAME="mydb"

§Change the user password salt for argon2 password hashing

export SERVER_PASSWORD_SALT="PLEASE_CHANGE_ME"

§JWT using the jsonwebtokens crate and encrypted using Algorithm::ES256 algorithm

§Change jwt private key

export TOKEN_ALGO_PRIVATE_KEY="path/private-key-pkcs8.pem"

§Change jwt public key

export TOKEN_ALGO_PUBLIC_KEY="path/public-key.pem"

§Tls Environment Variables

§Change the API Server tls certificate authority, server key and cert

export API_TLS_CA="path/api-ca.pem"
export API_TLS_KEY="path/api.key"
export API_TLS_CERT="path/api.crt"

§Change the Postgres tls certificate authority

export DB_TLS_CA="path/api-ca.pem"

§Logging

§Set the server name for the logs

export SERVER_NAME_LABEL="my-server"

§Debug

At startup, print a curl connectivity command and an openssl ssl verification command for postgres

export DEBUG="1"

Fields§

§label: String§server_address: String§server_password_salt: Vec<u8>§api_config: TlsConfig§db_conn_type: String§db_username: String§db_password: String§db_address: String§db_name: String§db_config: TlsConfig§encoding_key_bytes: Vec<u8>§decoding_key_bytes: Vec<u8>§kafka_publish_events: bool

Trait Implementations§

Source§

impl Clone for CoreConfig

Source§

fn clone(&self) -> CoreConfig

Returns a duplicate of the value. Read more
1.0.0 · Source§

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

Performs copy-assignment from source. Read more

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
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, dest: *mut u8)

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

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

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

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

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> 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.
Source§

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

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

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
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

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

impl<T> ErasedDestructor for T
where T: 'static,