Skip to content

Commit d3921ad

Browse files
docs: document debug path config (#669)
1 parent a0929fe commit d3921ad

File tree

3 files changed

+13
-2
lines changed

3 files changed

+13
-2
lines changed

super-agent/src/bin/main.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,6 @@ fn main() -> Result<(), Box<dyn Error>> {
4343

4444
#[cfg(debug_assertions)]
4545
{
46-
// Changing default directories if configured in CLI args
47-
// Explicit location flags get precedence over the general `debug`
4846
if let Some(ref local_path) = cli.local_dir {
4947
defaults::set_local_dir(local_path);
5048
}

super-agent/src/cli/mod.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,18 +13,29 @@ pub struct Cli {
1313
#[arg(long)]
1414
version: bool,
1515

16+
/// Overrides the default local configuration path `/etc/newrelic-super-agent/`.
17+
/// This config takes precedence over the general `debug`
1618
#[cfg(debug_assertions)]
1719
#[arg(long)]
1820
pub local_dir: Option<PathBuf>,
1921

22+
/// Overrides the default remote configuration path `/var/lib/newrelic-super-agent`.
23+
/// This config takes precedence over the general `debug`
2024
#[cfg(debug_assertions)]
2125
#[arg(long)]
2226
pub remote_dir: Option<PathBuf>,
2327

28+
/// Overrides the default log path `/var/log/newrelic-super-agent`.
29+
/// This config takes precedence over the general `debug`
2430
#[cfg(debug_assertions)]
2531
#[arg(long)]
2632
pub logs_dir: Option<PathBuf>,
2733

34+
/// Overrides the default paths used for local/remote configuration and logs to the following
35+
/// relatives paths.
36+
/// `/etc/newrelic-super-agent/` -> <defined path>/nrsa_local
37+
/// `/var/lib/newrelic-super-agent` -> <defined path>/nrsa_remote
38+
/// `/var/log/newrelic-super-agent` -> <defined path>/nrsa_logs
2839
#[cfg(debug_assertions)]
2940
#[arg(long, value_name = "DATA_DIR")]
3041
pub debug: Option<PathBuf>,

super-agent/src/super_agent/defaults.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ use tracing::debug;
1010

1111
// What does this do?
1212
// This macro generates a static variable and a function that returns a reference to that variable.
13+
// This allows to set this variables on initialization, like what is done when using the super-agent
14+
// `--debug` flag.
1315
// Given an identifier `SUPER_AGENT_ID` and a value `"super-agent"` of type `&str`, the macro call
1416
// `generate_const_getter!(SUPER_AGENT_ID, "super-agent")` generates the following:
1517
//

0 commit comments

Comments
 (0)