2023-06-04 11:02:51 +02:00
|
|
|
use clap::ValueEnum;
|
2023-08-20 14:08:40 +02:00
|
|
|
use como_auth::AuthClap;
|
2023-06-04 11:02:51 +02:00
|
|
|
|
2022-10-03 23:00:31 +02:00
|
|
|
#[derive(clap::Parser)]
|
|
|
|
pub struct AppConfig {
|
|
|
|
#[clap(long, env)]
|
|
|
|
pub database_url: String,
|
2023-06-04 11:02:51 +02:00
|
|
|
#[clap(long, env, default_value = "postgres")]
|
|
|
|
pub database_type: DatabaseType,
|
2022-10-03 23:00:31 +02:00
|
|
|
#[clap(long, env)]
|
|
|
|
pub rust_log: String,
|
2023-06-04 11:02:51 +02:00
|
|
|
#[clap(long, env, default_value = "3001")]
|
2022-10-04 12:06:00 +02:00
|
|
|
pub api_port: u32,
|
2023-06-04 11:02:51 +02:00
|
|
|
#[clap(long, env, default_value = "true")]
|
2022-10-03 23:00:31 +02:00
|
|
|
pub run_migrations: bool,
|
2023-06-04 11:02:51 +02:00
|
|
|
#[clap(long, env, default_value = "false")]
|
2022-10-03 23:00:31 +02:00
|
|
|
pub seed: bool,
|
|
|
|
#[clap(long, env)]
|
|
|
|
pub cors_origin: String,
|
2023-08-20 14:08:40 +02:00
|
|
|
|
|
|
|
#[clap(flatten)]
|
|
|
|
pub auth: AuthClap,
|
2022-10-03 23:00:31 +02:00
|
|
|
}
|
2023-06-04 11:02:51 +02:00
|
|
|
|
|
|
|
#[derive(Clone, Debug, ValueEnum)]
|
|
|
|
pub enum DatabaseType {
|
|
|
|
Postgres,
|
|
|
|
InMemory,
|
|
|
|
}
|