Skip to content

Commit

Permalink
fix: Only attempt to load yaml files when config-yaml is enabled (#451
Browse files Browse the repository at this point in the history
)
  • Loading branch information
spencewenski authored Oct 18, 2024
1 parent 57e5a55 commit 1788869
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/config/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ use crate::config::tracing::Tracing;
use crate::error::RoadsterResult;
use crate::util::serde::default_true;
use ::tracing::warn;
use cfg_if::cfg_if;
use config::builder::DefaultState;
use config::{Config, ConfigBuilder, FileFormat};
use convert_case::Case;
Expand Down Expand Up @@ -83,7 +84,14 @@ pub struct AppConfig {

pub const ENV_VAR_PREFIX: &str = "ROADSTER";
pub const ENV_VAR_SEPARATOR: &str = "__";
pub const FILE_EXTENSIONS: [&str; 3] = ["toml", "yaml", "yml"];

cfg_if! {
if #[cfg(feature = "config-yaml")] {
pub const FILE_EXTENSIONS: [&str; 3] = ["toml", "yaml", "yml"];
} else {
pub const FILE_EXTENSIONS: [&str; 1] = ["toml"];
}
}

impl AppConfig {
#[deprecated(
Expand Down

0 comments on commit 1788869

Please sign in to comment.