🚧 Restore use of concat_string! macro name

This commit is contained in:
Manuel Cillero 2024-11-17 08:31:16 +01:00
parent bf150d206f
commit 346dac7713
3 changed files with 10 additions and 10 deletions

View file

@ -74,7 +74,7 @@
// RE-EXPORTED *************************************************************************************
pub use concat_string::concat_string as join;
pub use concat_string::concat_string;
/// Enables flexible identifier concatenation in macros, allowing new items with pasted identifiers.
pub use paste::paste;

View file

@ -2,7 +2,7 @@
// RE-EXPORTED.
pub use crate::{join, main, paste, test};
pub use crate::{concat_string, main, paste, test};
pub use crate::{AutoDefault, StaticResources, TypeId, Weight};

View file

@ -1,6 +1,6 @@
//! Retrieve settings values from configuration files.
use crate::join;
use crate::concat_string;
use crate::util::data::ConfigData;
use crate::util::file::File;
@ -24,7 +24,7 @@ pub static CONFIG_DATA: LazyLock<ConfigData> = LazyLock::new(|| {
.unwrap_or_else(|_| "config".to_string());
// Execution mode based on the environment variable PAGETOP_RUN_MODE, defaults to 'default'.
let run_mode = env::var("PAGETOP_RUN_MODE").unwrap_or_else(|_| "default".into());
let rm = env::var("PAGETOP_RUN_MODE").unwrap_or_else(|_| "default".into());
// Initialize settings.
let mut settings = ConfigData::default();
@ -32,19 +32,19 @@ pub static CONFIG_DATA: LazyLock<ConfigData> = LazyLock::new(|| {
// Merge (optional) configuration files and set the execution mode.
settings
// First, add the common configuration for all environments. Defaults to 'common.toml'.
.merge(File::with_name(&join!(config_dir, "/common.toml")).required(false))
.merge(File::with_name(&concat_string!(config_dir, "/common.toml")).required(false))
.expect("Failed to merge common configuration (common.toml)")
// Add the environment-specific configuration. Defaults to 'default.toml'.
.merge(File::with_name(&join!(config_dir, "/", run_mode, ".toml")).required(false))
.expect(&format!("Failed to merge {run_mode}.toml configuration"))
.merge(File::with_name(&concat_string!(config_dir, "/", rm, ".toml")).required(false))
.expect(&format!("Failed to merge {rm}.toml configuration"))
// Add reserved local configuration for the environment. Defaults to 'local.default.toml'.
.merge(File::with_name(&join!(config_dir, "/local.", run_mode, ".toml")).required(false))
.merge(File::with_name(&concat_string!(config_dir, "/local.", rm, ".toml")).required(false))
.expect("Failed to merge reserved local environment configuration")
// Add the general reserved local configuration. Defaults to 'local.toml'.
.merge(File::with_name(&join!(config_dir, "/local.toml")).required(false))
.merge(File::with_name(&concat_string!(config_dir, "/local.toml")).required(false))
.expect("Failed to merge general reserved local configuration")
// Save the execution mode.
.set("app.run_mode", run_mode)
.set("app.run_mode", rm)
.expect("Failed to set application run mode");
settings