Skip to content

Commit

Permalink
Change config directory from .strikes to .config (#21)
Browse files Browse the repository at this point in the history
  • Loading branch information
tbsklg authored Sep 3, 2024
1 parent 195a29c commit 14d2b4a
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 10 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ You can use the local client without a remote server.
It will generate a JSON file where the strikes are stored.

## Configuration file
Provide a configuration file at ./strikes/configuration.yaml. The remote server configuration has precedence over the local configuration.
Provide a configuration file at .config/strikes/configuration.yaml. The remote server configuration has precedence over the local configuration.

```yaml
remote:
Expand Down
2 changes: 1 addition & 1 deletion cli-client/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion cli-client/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "strikes"
version = "0.2.4"
version = "0.2.5"
edition = "2021"

[lib]
Expand Down
10 changes: 5 additions & 5 deletions cli-client/src/configuration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ impl Default for Settings {
local: {
Some(LocalSettings {
db_path: std::env::var("HOME")
.map(|home| PathBuf::from(home).join(".strikes/db.json"))
.map(|home| PathBuf::from(home).join(".config/strikes/db.json"))
.unwrap(),
})
},
Expand All @@ -39,7 +39,7 @@ pub fn get_configuration(args: &Cli) -> Settings {
let config_path = args
.config_path
.clone()
.unwrap_or_else(|| PathBuf::from(home).join(".strikes/configuration.yaml"));
.unwrap_or_else(|| PathBuf::from(home).join(".config/strikes/configuration.yaml"));

let settings = config::Config::builder().add_source(config::File::new(
config_path.to_str().unwrap(),
Expand Down Expand Up @@ -77,7 +77,7 @@ mod tests {
);
assert_eq!(
configuration.local.unwrap().db_path,
PathBuf::from("/home/user/.strikes")
PathBuf::from("/home/user/.config/strikes/db.json")
);
}

Expand All @@ -93,7 +93,7 @@ mod tests {

assert_eq!(
configuration.local.unwrap().db_path,
PathBuf::from("/home/user/.strikes/db.json")
PathBuf::from("/home/user/.config/strikes/db.json")
);
}

Expand All @@ -109,7 +109,7 @@ mod tests {

assert_eq!(
configuration.local.unwrap().db_path,
PathBuf::from("/home/user/.strikes/db.json")
PathBuf::from("/home/user/.config/strikes/db.json")
)
}
}
3 changes: 1 addition & 2 deletions cli-client/tests/fixtures/valid_config.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
use_remote: true
remote:
api_key: abc
base_url: https://example.com
local:
db_path: /home/user/.strikes
db_path: /home/user/.config/strikes/db.json

0 comments on commit 14d2b4a

Please sign in to comment.