Basic create user account
This commit is contained in:
@ -16,17 +16,25 @@ pub struct AppConfig {
|
||||
#[clap(short, long, env)]
|
||||
pub proxy_ip: Option<String>,
|
||||
|
||||
/// PostgreSQL connexion chain
|
||||
#[clap(long, env, default_value = "postgres://localhost/geneit")]
|
||||
db_chain: String,
|
||||
/// PostgreSQL database host
|
||||
#[clap(long, env, default_value = "localhost")]
|
||||
db_host: String,
|
||||
|
||||
/// PostgreSQL database port
|
||||
#[clap(long, env, default_value_t = 5432)]
|
||||
db_port: u16,
|
||||
|
||||
/// PostgreSQL username
|
||||
#[clap(long, env, default_value = "user")]
|
||||
db_username: String,
|
||||
|
||||
/// PostgreSQL password
|
||||
#[clap(long, env, default_value = "user")]
|
||||
#[clap(long, env, default_value = "pass")]
|
||||
db_password: String,
|
||||
|
||||
/// PostgreSQL database name
|
||||
#[clap(long, env, default_value = "geneit")]
|
||||
db_name: String,
|
||||
}
|
||||
|
||||
lazy_static::lazy_static! {
|
||||
@ -40,4 +48,12 @@ impl AppConfig {
|
||||
pub fn get() -> &'static AppConfig {
|
||||
&ARGS
|
||||
}
|
||||
}
|
||||
|
||||
/// Get full db connection chain
|
||||
pub fn db_connection_chain(&self) -> String {
|
||||
format!(
|
||||
"postgres://{}:{}@{}:{}/{}",
|
||||
self.db_username, self.db_password, self.db_host, self.db_port, self.db_name
|
||||
)
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user