Struct restapi::core::core_config::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
sourceimpl Clone for CoreConfig
impl Clone for CoreConfig
sourcefn clone(&self) -> CoreConfig
fn clone(&self) -> CoreConfig
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreAuto Trait Implementations
impl !RefUnwindSafe for CoreConfig
impl Send for CoreConfig
impl Sync for CoreConfig
impl Unpin for CoreConfig
impl !UnwindSafe for CoreConfig
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more