telegraf/hamstats: template mqtt user and password via env files
This commit is contained in:
parent
0e8741a7d4
commit
24af872e85
|
@ -3,8 +3,8 @@
|
||||||
let
|
let
|
||||||
genTopic_zigbee = name: tags: {
|
genTopic_zigbee = name: tags: {
|
||||||
servers = [ "tcp://localhost:1883" ];
|
servers = [ "tcp://localhost:1883" ];
|
||||||
username = "stats";
|
username = "$HOME_MQTT_USER";
|
||||||
passwordFile = config.sops.secrets."mqtt/stats".path;
|
password = "$HOME_MQTT_PASSWORD";
|
||||||
qos = 0;
|
qos = 0;
|
||||||
connection_timeout = "30s";
|
connection_timeout = "30s";
|
||||||
topics = [ "/ham/zigbee/${name}" ];
|
topics = [ "/ham/zigbee/${name}" ];
|
||||||
|
@ -18,8 +18,8 @@ let
|
||||||
};
|
};
|
||||||
genTopic_plain = name: topic: tags: {
|
genTopic_plain = name: topic: tags: {
|
||||||
servers = [ "tcp://localhost:1883" ];
|
servers = [ "tcp://localhost:1883" ];
|
||||||
username = "stats";
|
username = "$HOME_MQTT_USER";
|
||||||
passwordFile = config.sops.secrets."mqtt/stats".path;
|
password = "$HOME_MQTT_PASSWORD";
|
||||||
qos = 0;
|
qos = 0;
|
||||||
connection_timeout = "30s";
|
connection_timeout = "30s";
|
||||||
topics = [ topic ];
|
topics = [ topic ];
|
||||||
|
@ -56,7 +56,10 @@ let
|
||||||
(esensor room name ''${room}_${name}_pressure'')
|
(esensor room name ''${room}_${name}_pressure'')
|
||||||
];
|
];
|
||||||
in {
|
in {
|
||||||
sops.secrets."mqtt/stats" = {};
|
sops.secrets."mqtt/stats.env" = {};
|
||||||
|
services.telegraf.environmentFiles = [
|
||||||
|
config.sops.secrets."mqtt/stats.env".path
|
||||||
|
];
|
||||||
services.telegraf.extraConfig.inputs.mqtt_consumer =
|
services.telegraf.extraConfig.inputs.mqtt_consumer =
|
||||||
(zigbee_temphum "Wohnzimmer" "temp1")
|
(zigbee_temphum "Wohnzimmer" "temp1")
|
||||||
++ (zigbee_temphum "Badezimmer" "temp2")
|
++ (zigbee_temphum "Badezimmer" "temp2")
|
||||||
|
|
Loading…
Reference in a new issue