Skip to content

Commit 4155bc0

Browse files
committed
feat: added mode and env to aquila
1 parent b7ca3cb commit 4155bc0

3 files changed

Lines changed: 47 additions & 0 deletions

File tree

src/configuration/env.rs

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
use std::fmt;
2+
3+
use serde::{Deserialize, Serialize};
4+
5+
#[derive(Clone, Copy, Debug, Default, Deserialize, Serialize, PartialEq, Eq)]
6+
#[serde(rename_all = "lowercase")]
7+
pub enum Environment {
8+
#[default]
9+
Development,
10+
Staging,
11+
Production,
12+
}
13+
14+
impl fmt::Display for Environment {
15+
fn fmt(&self, formatter: &mut fmt::Formatter<'_>) -> fmt::Result {
16+
let value = match self {
17+
Self::Development => "development",
18+
Self::Staging => "staging",
19+
Self::Production => "production",
20+
};
21+
formatter.write_str(value)
22+
}
23+
}

src/configuration/mod.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
pub mod config;
2+
pub mod env;
3+
pub mod mode;
24
pub mod service;
35
pub mod state;

src/configuration/mode.rs

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
use std::fmt;
2+
3+
use serde::{Deserialize, Serialize};
4+
5+
/// Controls whether flows are loaded locally or synchronized with Sagittarius.
6+
#[derive(Clone, Copy, Debug, Default, Deserialize, Serialize, PartialEq, Eq)]
7+
#[serde(rename_all = "lowercase")]
8+
pub enum Mode {
9+
#[default]
10+
Static,
11+
Dynamic,
12+
}
13+
14+
impl fmt::Display for Mode {
15+
fn fmt(&self, formatter: &mut fmt::Formatter<'_>) -> fmt::Result {
16+
let value = match self {
17+
Self::Static => "static",
18+
Self::Dynamic => "dynamic",
19+
};
20+
formatter.write_str(value)
21+
}
22+
}

0 commit comments

Comments
 (0)