reifydb_sub_admin/config/
admin.rs1#[derive(Debug, Clone)]
5pub struct AdminConfig {
6 pub enabled: bool,
7 pub port: u16,
8 pub bind_address: String,
9 pub auth_required: bool,
10 pub auth_token: Option<String>,
11}
12
13impl AdminConfig {
14 pub fn new() -> Self {
15 Self::default()
16 }
17
18 pub fn with_port(mut self, port: u16) -> Self {
19 self.port = port;
20 self
21 }
22
23 pub fn with_auth(mut self, token: String) -> Self {
24 self.auth_required = true;
25 self.auth_token = Some(token);
26 self
27 }
28
29 pub fn address(&self) -> String {
30 format!("{}:{}", self.bind_address, self.port)
31 }
32}
33
34impl Default for AdminConfig {
35 fn default() -> Self {
36 Self {
37 enabled: true,
38 port: 9090,
39 bind_address: "127.0.0.1".to_string(),
40 auth_required: false,
41 auth_token: None,
42 }
43 }
44}