Self-hosted fleet management platform for Linux
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

chore: migrate config into server crate

+49 -6
+8
Cargo.lock
··· 536 536 "clap", 537 537 "lucid-api", 538 538 "lucid-core", 539 + "lucid-server-config", 539 540 "tokio", 540 541 "tokio-util", 541 542 "tracing", 542 543 "tracing-subscriber", 544 + ] 545 + 546 + [[package]] 547 + name = "lucid-server-config" 548 + version = "0.1.0-alpha.0" 549 + dependencies = [ 550 + "confique", 543 551 ] 544 552 545 553 [[package]]
+2
Cargo.toml
··· 6 6 "crates/core/auth", 7 7 "crates/database", 8 8 "crates/server", 9 + "crates/server/config", 9 10 ] 10 11 11 12 [workspace.package] ··· 22 23 lucid-database = { path = "crates/database" } 23 24 24 25 lucid-server = { path = "crates/server" } 26 + lucid-server-config = { path = "crates/server/config" } 25 27 26 28 anyhow = "1.0" 27 29 axum = { version = "0.8", features = ["macros"] }
crates/core/src/config.rs crates/server/config/src/lib.rs
-2
crates/core/src/lib.rs
··· 1 - pub mod config; 2 - 3 1 pub const BUILD_VERSION: &str = concat!( 4 2 env!("CARGO_PKG_VERSION"), 5 3 " (rev. ",
+1
crates/server/Cargo.toml
··· 11 11 [dependencies] 12 12 lucid-api.workspace = true 13 13 lucid-core.workspace = true 14 + lucid-server-config.workspace = true 14 15 15 16 axum.workspace = true 16 17 clap.workspace = true
+8
crates/server/config/Cargo.toml
··· 1 + [package] 2 + name = "lucid-server-config" 3 + version.workspace = true 4 + edition.workspace = true 5 + license.workspace = true 6 + 7 + [dependencies] 8 + confique.workspace = true
+26
crates/server/config/build.rs
··· 1 + use std::process::Command; 2 + 3 + fn main() { 4 + let timestamp = Command::new("date") 5 + .arg("+%Y-%m-%d %H:%M:%S UTC") 6 + .output() 7 + .map(|o| String::from_utf8_lossy(&o.stdout).trim().to_string()) 8 + .unwrap_or_else(|_| "unknown".to_string()); 9 + 10 + let git_sha = Command::new("git") 11 + .args(["rev-parse", "HEAD"]) 12 + .output() 13 + .map(|o| String::from_utf8_lossy(&o.stdout).trim().to_string()) 14 + .unwrap_or_else(|_| "unknown".to_string()); 15 + 16 + let git_branch = Command::new("git") 17 + .args(["rev-parse", "--abbrev-ref", "HEAD"]) 18 + .output() 19 + .map(|o| String::from_utf8_lossy(&o.stdout).trim().to_string()) 20 + .unwrap_or_else(|_| "unknown".to_string()); 21 + 22 + println!("cargo:rustc-env=BUILD_TIMESTAMP={}", timestamp); 23 + println!("cargo:rustc-env=BUILD_GIT_SHA={}", git_sha); 24 + println!("cargo:rustc-env=BUILD_GIT_BRANCH={}", git_branch); 25 + println!("cargo:rerun-if-changed=build.rs"); 26 + }
+4 -4
crates/server/src/main.rs
··· 30 30 if let Some(command) = cli.command { 31 31 return match command { 32 32 Command::ConfigTemplate => { 33 - print!("{}", lucid_core::config::template()); 33 + print!("{}", lucid_server_config::template()); 34 34 ExitCode::SUCCESS 35 35 } 36 36 } ··· 38 38 39 39 tracing_subscriber::fmt::init(); 40 40 41 - let config = match lucid_core::config::load(cli.config.as_ref()) { 41 + let config = match lucid_server_config::load(cli.config.as_ref()) { 42 42 Ok(config) => config, 43 43 Err(e) => { 44 44 error!("Failed to load configuration: {e:#}"); ··· 46 46 } 47 47 }; 48 48 49 - lucid_core::config::init(config); 49 + lucid_server_config::init(config); 50 50 51 51 match run().await { 52 52 Ok(()) => ExitCode::SUCCESS, ··· 73 73 74 74 let app = lucid_api::app(state); 75 75 76 - let cfg = lucid_core::config::get(); 76 + let cfg = lucid_server_config::get(); 77 77 78 78 let host = &cfg.server.host; 79 79 let port = cfg.server.port;