Skip to content

Commit cefbfb8

Browse files
committed
debug settings dir
1 parent 13eee7a commit cefbfb8

File tree

3 files changed

+18
-1
lines changed

3 files changed

+18
-1
lines changed

services/src/bin/main.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,11 @@ use tracing_subscriber::EnvFilter;
1414
use tracing_subscriber::Layer;
1515

1616
#[tokio::main]
17+
#[allow(clippy::dbg_macro)]
18+
#[allow(unused_must_use)]
19+
1720
async fn main() {
21+
dbg!(std::env::var("GEOENGINE_SETTINGS_FILE_PATH"));
1822
start_server().await.unwrap();
1923
}
2024

services/src/util/config.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ static SETTINGS: OnceLock<RwLock<Config>> = OnceLock::new();
1818
const SETTINGS_FILE_PATH_OVERRIDE_ENV_VAR: &str = "GEOENGINE_SETTINGS_FILE_PATH";
1919

2020
// TODO: change to `LazyLock' once stable
21+
#[allow(clippy::dbg_macro)]
2122
fn init_settings() -> RwLock<Config> {
2223
let mut settings = Config::builder();
2324

@@ -28,17 +29,27 @@ fn init_settings() -> RwLock<Config> {
2829

2930
settings = settings.add_source(File::from_str(default_settings, FileFormat::Toml));
3031

32+
std::env::vars().for_each(|(key, value)| {
33+
dbg!((&key, &value));
34+
});
35+
3136
if let Ok(settings_file_path) = std::env::var(SETTINGS_FILE_PATH_OVERRIDE_ENV_VAR) {
37+
dbg!(
38+
"Settings file path: {} (set by environment variable)",
39+
&settings_file_path
40+
);
3241
// override the settings file path
3342
settings = settings.add_source(File::with_name(&settings_file_path));
3443
} else {
3544
// use the default settings file path
3645
#[cfg(test)]
3746
{
47+
dbg!("Settings file path: Settings-test.toml");
3848
settings = settings.add_source(File::from(dir.join("Settings-test.toml")));
3949
}
4050
#[cfg(not(test))]
4151
{
52+
dbg!("Settings file path: Settings.toml");
4253
settings = settings.add_source(File::from(dir.join("Settings.toml")));
4354
}
4455
}

services/tests/startup.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,10 @@ impl Drop for DroppingServer {
1717
}
1818

1919
impl DroppingServer {
20+
#[allow(clippy::dbg_macro)]
2021
fn new(schema_name: &str) -> Self {
2122
let dir = geoengine_services::util::config::retrieve_settings_dir().unwrap();
23+
dbg!("Settings dir: {:?}", &dir);
2224

2325
let process = Command::cargo_bin("main")
2426
.unwrap()
@@ -62,7 +64,7 @@ async fn it_starts_without_warnings_and_accepts_connections() {
6264
// read log output and check for warnings
6365
let mut startup_succesful = false;
6466
for line in server.stderr_lines().take(100) {
65-
// eprintln!("Line: {line}");
67+
eprintln!("Line: {line}");
6668

6769
assert!(!line.contains("WARN"), "Warning in log output: {line}");
6870

0 commit comments

Comments
 (0)