kanidm_proto/
cli.rs

1use crate::internal::FsType;
2use clap::Parser;
3
4#[derive(Debug, Parser, Clone)]
5pub struct KanidmdCli {
6    /// Output formatting
7    #[clap(
8        short,
9        long = "output",
10        env = "KANIDM_OUTPUT",
11        default_value = "text",
12        global = true,
13        help = "Specify the console output format (text, json)"
14    )]
15    pub output_mode: crate::messages::ConsoleOutputMode,
16
17    #[clap(
18        env = "KANIDM_LOG_LEVEL",
19        global = true,
20        help = "Specify the log level (info, debug, trace)"
21    )]
22    pub log_level: Option<sketching::LogLevel>,
23
24    #[clap(
25        env = "KANIDM_OTEL_GRPC_URL",
26        global = true,
27        help = "Specify the OpenTelemetry gRPC URL"
28    )]
29    pub otel_grpc_url: Option<String>,
30
31    #[clap(env = "KANIDM_DOMAIN", global = true, help = "Specify the domain")]
32    pub domain: Option<String>,
33
34    #[clap(env = "KANIDM_ORIGIN", global = true, help = "Specify the origin URL")]
35    pub origin: Option<url::Url>,
36
37    #[clap(env = "KANIDM_ROLE", global = true, help = "Specify the server role")]
38    pub role: Option<crate::config::ServerRole>,
39
40    #[clap(
41        env = "KANIDM_DB_PATH",
42        global = true,
43        help = "Specify the database path"
44    )]
45    pub db_path: Option<std::path::PathBuf>,
46
47    #[clap(
48        env = "KANIDM_DB_FS_TYPE",
49        global = true,
50        help = "Specify the database filesystem type, either zfs or generic"
51    )]
52    pub db_fs_type: Option<FsType>,
53
54    #[clap(
55        env = "KANIDM_DB_ARC_SIZE",
56        global = true,
57        help = "Specify the database ARC size in bytes"
58    )]
59    pub db_arc_size: Option<usize>,
60
61    #[clap(
62        env = "KANIDM_SERVER_ADMIN_BIND_PATH",
63        global = true,
64        help = "Specify the admin bind path"
65    )]
66    pub admin_bind_path: Option<String>,
67
68    // TLS
69    #[clap(
70        env = "KANIDM_TLS_CHAIN",
71        global = true,
72        help = "Specify the TLS chain file path"
73    )]
74    pub tls_chain: Option<std::path::PathBuf>,
75    #[clap(
76        env = "KANIDM_TLS_KEY",
77        global = true,
78        help = "Specify the TLS key file path"
79    )]
80    pub tls_key: Option<std::path::PathBuf>,
81
82    #[clap(
83        env = "KANIDM_TLS_CLIENT_CA",
84        global = true,
85        help = "Specify the TLS client CA file path"
86    )]
87    pub tls_client_ca: Option<std::path::PathBuf>,
88
89    // networking
90    #[clap(
91        env = "KANIDM_BINDADDRESS",
92        global = true,
93        help = "Specify the HTTPS server bind address(es)"
94    )]
95    pub bindaddress: Option<String>,
96
97    #[clap(
98        env = "KANIDM_LDAPBINDADDRESS",
99        global = true,
100        help = "Specify the LDAP bind address(es)"
101    )]
102    pub ldapbindaddress: Option<String>,
103
104    #[clap(
105        global = true,
106        hide = true,
107        env = "KANIDM_TRUST_X_FORWARDED_FOR",
108        help = "Whether to blindly trust the X-Forwarded-For header, regardless of source IP"
109    )]
110    pub trust_all_x_forwarded_for: Option<bool>,
111
112    // replication
113    #[clap(
114        env = "KANIDM_REPLICATION_ORIGIN",
115        global = true,
116        help = "Specify the replication origin URL"
117    )]
118    pub replication_origin: Option<url::Url>,
119
120    #[clap(
121        env = "KANIDM_REPLICATION_BINDADDRESS",
122        global = true,
123        help = "Specify the replication bind address"
124    )]
125    pub replication_bindaddress: Option<std::net::SocketAddr>,
126
127    #[clap(
128        env = "KANIDM_REPLICATION_TASK_POLL_INTERVAL",
129        global = true,
130        help = "Specify the replication task poll interval in seconds"
131    )]
132    pub replication_task_poll_interval: Option<u64>,
133
134    // backup things
135    #[clap(
136        env = "KANIDM_ONLINE_BACKUP_PATH",
137        global = true,
138        help = "Specify the online backup path"
139    )]
140    pub online_backup_path: Option<std::path::PathBuf>,
141
142    #[clap(
143        global = true,
144        env = "KANIDM_ONLINE_BACKUP_VERSIONS",
145        help = "Number of online backup versions to keep"
146    )]
147    pub online_backup_versions: Option<usize>,
148
149    #[clap(
150        global = true,
151        env = "KANIDM_ONLINE_BACKUP_SCHEDULE",
152        help = "Cron schedule for online backups",
153        last = true
154    )]
155    pub online_backup_schedule: Option<String>,
156}