Skip to content

Commit fbbb8a7

Browse files
authored
feat: simplify config (#99)
* move remove cb-config env * optional metrics and .env * example config * optional logs * optional cadivsor * more config examples * typo
1 parent f1e6ff1 commit fbbb8a7

File tree

13 files changed

+398
-321
lines changed

13 files changed

+398
-321
lines changed

config.example.toml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,7 @@ docker_image = "test_da_commit"
118118
sleep_secs = 5
119119

120120
# Configuration for how metrics should be collected and scraped
121+
# OPTIONAL, skip metrics collection if missing
121122
[metrics]
122123
# Path to a `prometheus.yml` file to use in Prometheus. If using a custom config file, be sure to add a
123124
# file discovery section as follows:
@@ -131,13 +132,13 @@ prometheus_config = "./docker/prometheus.yml"
131132
# Whether to start Grafana with built-in dashboards
132133
# OPTIONAL, DEFAULT: true
133134
use_grafana = true
135+
# Whether to start cadvisor for system monitoring
136+
# OPTIONAL, DEFAULT: true
137+
use_cadvisor = true
134138

135139
# Configuration for how logs should be collected and stored
136-
# OPTIONAL
140+
# OPTIONAL, info to stdout if missing
137141
[logs]
138-
# Log rotation policy. Supported values: hourly, daily, never
139-
# OPTIONAL, DEFAULT: daily
140-
rotation = "daily"
141142
# Path to the log directory
142143
# OPTIONAL, DEFAULT: /var/logs/commit-boost
143144
log_dir_path = "./logs"

configs/minimal.toml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# Minimal PBS config, with no metrics and only stdout logs
2+
3+
chain = "Holesky"
4+
5+
[pbs]
6+
port = 18550
7+
8+
[[relays]]
9+
id = "example-relay"
10+
url = "http://0xa1cec75a3f0661e99299274182938151e8433c61a19222347ea1313d839229cb4ce4e3e5aa2bdeb71c8fcf1b084963c2@abc.xyz"

configs/pbs_metrics.toml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# PBS + metrics + logs to file
2+
3+
chain = "Holesky"
4+
5+
[pbs]
6+
port = 18550
7+
8+
[[relays]]
9+
id = "example-relay"
10+
url = "http://0xa1cec75a3f0661e99299274182938151e8433c61a19222347ea1313d839229cb4ce4e3e5aa2bdeb71c8fcf1b084963c2@abc.xyz"
11+
12+
[metrics]
13+
prometheus_config = "./docker/prometheus.yml"
14+
use_grafana = true
15+
use_cadvisor = false
16+
17+
[logs]
18+
log_dir_path = "./logs"

crates/cli/src/docker_cmd.rs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -72,13 +72,14 @@ fn is_command_available(command: &str) -> bool {
7272
.map_or(false, |output| output.status.success())
7373
}
7474

75-
pub fn handle_docker_start(compose_path: String, env_path: String) -> Result<()> {
75+
pub fn handle_docker_start(compose_path: String, env_path: Option<String>) -> Result<()> {
7676
println!("Starting Commit-Boost with compose file: {}", compose_path);
7777

78-
// load env file
79-
let env_file = dotenvy::from_filename_override(env_path)?;
80-
81-
println!("Loaded env file: {:?}", env_file);
78+
// load env file if present
79+
if let Some(env_path) = env_path {
80+
let env_file = dotenvy::from_filename_override(env_path)?;
81+
println!("Loaded env file: {:?}", env_file);
82+
}
8283

8384
// start docker compose
8485
run_docker_compose!(compose_path, "up", "-d");

0 commit comments

Comments
 (0)