Add base server

This commit is contained in:
2023-05-24 14:38:18 +02:00
parent df64d51445
commit 9912428fd6
10 changed files with 1292 additions and 19 deletions

View File

@ -0,0 +1,43 @@
use clap::Parser;
/// GeneIT backend API
#[derive(Parser, Debug, Clone)]
#[clap(author, version, about, long_about = None)]
pub struct AppConfig {
/// Listen address
#[clap(short, long, env, default_value = "0.0.0.0:8000")]
pub listen_address: String,
/// Website origin
#[clap(short, long, env, default_value = "http://localhost:3000")]
pub website_origin: String,
/// Proxy IP, might end with a star "*"
#[clap(short, long, env)]
pub proxy_ip: Option<String>,
/// PostgreSQL connexion chain
#[clap(long, env, default_value = "postgres://localhost/geneit")]
db_chain: String,
/// PostgreSQL username
#[clap(long, env, default_value = "user")]
db_username: String,
/// PostgreSQL password
#[clap(long, env, default_value = "user")]
db_password: String,
}
lazy_static::lazy_static! {
static ref ARGS: AppConfig = {
AppConfig::parse()
};
}
impl AppConfig {
/// Get parsed command line arguments
pub fn get() -> &'static AppConfig {
&ARGS
}
}