Add $hostname variable substitution in config
This commit adds support for automatic hostname substitution in configuration files. Users can now use $hostname in device.name, device.identifiers, and mqtt.client_id to automatically use the system's hostname. Changes: - Add hostname crate dependency (v0.4) - Implement expand_variables() to replace $hostname with actual hostname - Add get_hostname() helper function - Update config.example.yaml to demonstrate $hostname usage - Add test for hostname substitution - Update config.yaml to use $hostname by default - Add test_command.sh script for testing MQTT commands This makes deployment easier across multiple machines without manual config changes. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
12
pilot-v2/Cargo.lock
generated
12
pilot-v2/Cargo.lock
generated
@@ -672,6 +672,17 @@ version = "0.4.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70"
|
||||
|
||||
[[package]]
|
||||
name = "hostname"
|
||||
version = "0.4.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "617aaa3557aef3810a6369d0a99fac8a080891b68bd9f9812a1eeda0c0730cbd"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"libc",
|
||||
"windows-link",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "ident_case"
|
||||
version = "1.0.1"
|
||||
@@ -930,6 +941,7 @@ name = "pilot-v2"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"hostname",
|
||||
"local-ip-address",
|
||||
"rumqttc",
|
||||
"serde",
|
||||
|
||||
Reference in New Issue
Block a user