Skip to content

Commit 13eee7a

Browse files
committed
fix settings directory
1 parent 0dd2aa9 commit 13eee7a

File tree

2 files changed

+7
-8
lines changed

2 files changed

+7
-8
lines changed

services/src/util/config.rs

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,7 @@ fn init_settings() -> RwLock<Config> {
5353
}
5454

5555
/// test may run in subdirectory
56-
#[cfg(test)]
57-
fn retrieve_settings_dir() -> Result<PathBuf> {
56+
pub fn retrieve_settings_dir() -> Result<PathBuf> {
5857
use crate::error::Error;
5958

6059
const MAX_PARENT_DIRS: usize = 1;
@@ -75,11 +74,6 @@ fn retrieve_settings_dir() -> Result<PathBuf> {
7574
Err(Error::MissingSettingsDirectory)
7675
}
7776

78-
#[cfg(not(test))]
79-
fn retrieve_settings_dir() -> Result<PathBuf> {
80-
std::env::current_dir().context(error::MissingWorkingDirectory)
81-
}
82-
8377
#[cfg(test)]
8478
pub fn set_config<T>(key: &str, value: T) -> Result<()>
8579
where

services/tests/startup.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,14 @@ impl Drop for DroppingServer {
1818

1919
impl DroppingServer {
2020
fn new(schema_name: &str) -> Self {
21+
let dir = geoengine_services::util::config::retrieve_settings_dir().unwrap();
22+
2123
let process = Command::cargo_bin("main")
2224
.unwrap()
23-
.env("GEOENGINE_SETTINGS_FILE_PATH", "Settings-test.toml")
25+
.env(
26+
"GEOENGINE_SETTINGS_FILE_PATH",
27+
dir.join("Settings-test.toml"),
28+
)
2429
.env("GEOENGINE_POSTGRES__SCHEMA", schema_name)
2530
.stderr(Stdio::piped())
2631
.spawn()

0 commit comments

Comments
 (0)