Skip to content

Commit 6799a70

Browse files
committed
feat(config): allow env vars, add comments on default config
1 parent cf0da95 commit 6799a70

7 files changed

Lines changed: 509 additions & 180 deletions

File tree

Cargo.lock

Lines changed: 112 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

soar-cli/src/main.rs

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ use state::AppState;
2424
use tracing::{error, info, warn};
2525
use update::update_packages;
2626
use use_package::use_alternate_package;
27-
use utils::{Colored, COLOR};
27+
use utils::COLOR;
2828

2929
mod cli;
3030
mod download;
@@ -243,17 +243,14 @@ async fn handle_cli() -> SoarResult<()> {
243243
cli::Commands::Env => {
244244
let config = get_config();
245245

246-
info!(
247-
"[{}]: These values are not configurable via environment \
248-
variables. They are derived from the config file or defaults.",
249-
Colored(nu_ansi_term::Color::Yellow, "NOTE")
250-
);
251-
252246
info!("SOAR_CONFIG={}", CONFIG_PATH.read()?.display());
253247
info!("SOAR_BIN={}", config.get_bin_path()?.display());
254248
info!("SOAR_DB={}", config.get_db_path()?.display());
255249
info!("SOAR_CACHE={}", config.get_cache_path()?.display());
256-
info!("SOAR_PACKAGE={}", config.get_packages_path(None)?.display());
250+
info!(
251+
"SOAR_PACKAGES={}",
252+
config.get_packages_path(None)?.display()
253+
);
257254
info!(
258255
"SOAR_REPOSITORIES={}",
259256
config.get_repositories_path()?.display()
@@ -297,7 +294,7 @@ async fn handle_cli() -> SoarResult<()> {
297294
Ok(v) => v,
298295
Err(err) if err.kind() == std::io::ErrorKind::NotFound => {
299296
warn!("Config file {} not found", config_path.display());
300-
let def_config = Config::default();
297+
let def_config = Config::generate_default_config(false);
301298
toml::to_string_pretty(&def_config)?
302299
}
303300
Err(err) => {

soar-core/Cargo.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ categories.workspace = true
1313
[dependencies]
1414
blake3 = { version = "1.8.1", features = ["mmap"] }
1515
chrono = { version = "0.4.40", default-features = false, features = ["now"] }
16+
documented = "0.9.1"
1617
futures = { workspace = true }
1718
image = { version = "0.25.6", default-features = false, features = ["png"] }
1819
include_dir = "0.7.4"
@@ -28,5 +29,6 @@ soar-dl = { workspace = true }
2829
squishy = { version = "0.3.2", features = ["appimage"] }
2930
thiserror = "2.0.12"
3031
toml = "0.8.20"
32+
toml_edit = "0.22.26"
3133
tracing = { workspace = true }
3234
zstd = "0.13.3"

0 commit comments

Comments
 (0)