Skip to main content

ave_bridge/settings/
command.rs

1use std::env;
2
3use clap::Parser;
4
5#[derive(Parser, Debug)]
6#[command(version, about, long_about = None)]
7pub struct Args {
8    /// Path to the file containing the settings you want to use
9    #[arg(short = 'c', long, default_value_t = String::default())]
10    pub config_path: String,
11
12    /// Password to be used for the creation of the cryptographic material, if not specified, the password of the environment variable 'AVE_PASSWORD' will be used.
13    #[arg(short = 'k', long, default_value_t = String::default())]
14    pub key_password: String,
15
16    /// Password to be used for the creation of the cryptographic material, if not specified, the password of the environment variable 'AVE_PASSWORD' will be used.
17    #[arg(short = 'a', long, default_value_t = String::default())]
18    pub auth_password: String,
19
20    /// Password to be used to auth for sinks.
21    #[arg(short = 's', long, default_value_t = String::default())]
22    pub sink_password: String,
23
24    /// API key to be used for sink authentication (alternative to password-based auth).
25    #[arg(short = 'S', long, default_value_t = String::default())]
26    pub sink_api_key: String,
27}
28
29pub fn build_sink_password() -> String {
30    env::var("AVE_SINK_PASSWORD").unwrap_or_default()
31}
32
33pub fn build_sink_api_key() -> String {
34    env::var("AVE_SINK_API_KEY").unwrap_or_default()
35}
36
37pub fn build_auth_password() -> String {
38    env::var("AVE_AUTH_PASSWORD").unwrap_or_default()
39}
40
41pub fn build_key_password() -> String {
42    env::var("AVE_KEY_PASSWORD").unwrap_or_default()
43}
44
45pub fn build_config_path() -> String {
46    env::var("AVE_CONFIG").unwrap_or_default()
47}