Skip to content

Conversation

ceresnam
Copy link

@ceresnam ceresnam commented Apr 5, 2025

This change enables specifying multiple WireGuard configuration files for the extract_names_config_files option using the PROMETHEUS_WIREGUARD_EXPORTER_CONFIG_FILE_NAMES environment variable.

It utilizes std::env::split_paths to automatically handle the correct OS-specific path list separator (: for Linux/Unix, ; for Windows).

Example (Environment Variable):

PROMETHEUS_WIREGUARD_EXPORTER_CONFIG_FILE_NAMES="/tmp/wg1/conf:/tmp/wg2.conf" prometheus_wireguard_exporter

This correctly parses as:

[INFO] using options: Options { extract_names_config_files: Some(["/tmp/wg1/conf", "/tmp/wg2.conf"]) }

This complements the existing command-line functionality:

prometheus_wireguard_exporter -n /tmp/wg1/conf /tmp/wg2.conf

Which also parses as:

[INFO] using options: Options { extract_names_config_files: Some(["/tmp/wg1/conf", "/tmp/wg2.conf"]) }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant