From c137136d4d7b1b291eb9d23371bfe6e37dc6b152 Mon Sep 17 00:00:00 2001 From: Orne Brocaar Date: Thu, 20 Mar 2025 11:47:42 +0000 Subject: [PATCH] Update chirpstack configfile template. See also chirpstack/chirpstack-docs#25 --- chirpstack/src/cmd/configfile.rs | 29 ++++++++++++++++------------- 1 file changed, 16 insertions(+), 13 deletions(-) diff --git a/chirpstack/src/cmd/configfile.rs b/chirpstack/src/cmd/configfile.rs index 2db4921c..d3d6e047 100644 --- a/chirpstack/src/cmd/configfile.rs +++ b/chirpstack/src/cmd/configfile.rs @@ -3,9 +3,7 @@ use handlebars::Handlebars; use super::super::config; pub fn run() { - #[allow(clippy::useless_vec)] - let template = vec![ -r#" + let template = r#" # Logging configuration [logging] @@ -21,10 +19,11 @@ r#" # Log as JSON. json={{ logging.json }} -"#, -#[cfg(feature = "postgres")] -r#" + + # PostgreSQL configuration. +# +# Note: this option is only available to ChirpStack with PostgreSQL support (default). [postgresql] # PostgreSQL DSN. @@ -49,16 +48,20 @@ r#" # the server-certificate is not signed by a CA in the platform certificate # store. ca_cert="{{ postgresql.ca_cert }}" -"#, -#[cfg(feature = "sqlite")] -r#" + + # SQLite configuration. +# +# Note: this option is only available to ChirpStack with SQLite support. [sqlite] # Sqlite DB path. # - # Format example: sqlite:///. + # Make sure the path exists and that the ChirpStack process has read-write + # access to it. If the database file does not exists, it will be created the + # first time ChirpStack starts. # + # Format example: sqlite:///. path="{{ sqlite.path }}" # Max open connections. @@ -77,8 +80,8 @@ r#" "{{this}}", {{/each}} ] -"#, -r#" + + # Redis configuration. [redis] @@ -990,7 +993,7 @@ r#" # default tileserver_url (OSM). If you configure a different tile-server, you # might need to update the map_attribution. map_attribution="{{ui.map_attribution}}" -"#].join("\n"); +"#; let mut reg = Handlebars::new(); reg.register_escape_fn(|s| s.to_string().replace('"', r#"\""#));