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: Stringserver_address: Stringserver_password_salt: Vec<u8>api_config: TlsConfigdb_conn_type: Stringdb_username: Stringdb_password: Stringdb_address: Stringdb_name: Stringdb_config: TlsConfigencoding_key_bytes: Vec<u8>decoding_key_bytes: Vec<u8>kafka_publish_events: bool

Trait Implementations

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

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

Calls U::from(self).

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

Should always be Self
The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.
Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more