mirror of
https://github.com/NotAShelf/air-quality-monitor.git
synced 2024-11-22 21:31:11 +00:00
concat missing environment variables
This commit is contained in:
parent
5c7691ba6b
commit
8426341a37
2 changed files with 11 additions and 4 deletions
|
@ -112,6 +112,10 @@ in {
|
||||||
};
|
};
|
||||||
|
|
||||||
systemd.services."pi-air-quality-monitor" = let
|
systemd.services."pi-air-quality-monitor" = let
|
||||||
|
globalEnv = pkgs.writeText "global.env" ''
|
||||||
|
SERIAL_DEVICE=${cfg.settings.serialPort}
|
||||||
|
'';
|
||||||
|
|
||||||
redisEnv = pkgs.writeText "redis.env" ''
|
redisEnv = pkgs.writeText "redis.env" ''
|
||||||
REDIS_HOST=${cfg.settings.redis.host}
|
REDIS_HOST=${cfg.settings.redis.host}
|
||||||
REDIS_PORT=${toString cfg.settings.redis.port}
|
REDIS_PORT=${toString cfg.settings.redis.port}
|
||||||
|
@ -125,7 +129,11 @@ in {
|
||||||
Type = "simple";
|
Type = "simple";
|
||||||
User = cfg.settings.user;
|
User = cfg.settings.user;
|
||||||
Group = cfg.settings.group;
|
Group = cfg.settings.group;
|
||||||
EnvironmentFile = [redisEnv] ++ optional (cfg.settings.environmentFile != null) cfg.settings.environmentFile;
|
EnvironmentFile = lib.concatLists [
|
||||||
|
[globalEnv]
|
||||||
|
(optional (cfg.settings.environmentFile != null) [cfg.settings.environmentFile])
|
||||||
|
(optional cfg.settings.redis.createLocally [redisEnv])
|
||||||
|
];
|
||||||
WorkingDirectory = "${cfg.settings.dataDir}";
|
WorkingDirectory = "${cfg.settings.dataDir}";
|
||||||
ExecStart = "${lib.getExe cfg.package}";
|
ExecStart = "${lib.getExe cfg.package}";
|
||||||
Restart = "always";
|
Restart = "always";
|
||||||
|
|
|
@ -57,18 +57,17 @@ in
|
||||||
log.info("Check if unit is running correctly")
|
log.info("Check if unit is running correctly")
|
||||||
server.wait_for_unit("pi-air-quality-monitor.service")
|
server.wait_for_unit("pi-air-quality-monitor.service")
|
||||||
server.succeed("systemctl status pi-air-quality-monitor.service | grep 'Active: active (running)' >&2")
|
server.succeed("systemctl status pi-air-quality-monitor.service | grep 'Active: active (running)' >&2")
|
||||||
server.succeed("journalctl -u pi-air-quality-monitor.service >&2")
|
server.fail("journalctl -u pi-air-quality-monitor.service | grep 'RuntimeError'")
|
||||||
|
|
||||||
log.info("Showing units content")
|
log.info("Showing units content")
|
||||||
server.succeed("systemctl status pi-air-quality-monitor.service >&2")
|
server.succeed("systemctl status pi-air-quality-monitor.service >&2")
|
||||||
server.succeed("systemctl cat pi-air-quality-monitor.service >&2")
|
server.succeed("systemctl cat pi-air-quality-monitor.service >&2")
|
||||||
server.succeed("systemctl cat pi-air-quality-monitor.socket >&2")
|
|
||||||
|
|
||||||
log.info("Checking if service is accessible locally")
|
log.info("Checking if service is accessible locally")
|
||||||
server.succeed("nc -vz localhost 8080")
|
server.succeed("nc -vz localhost 8080")
|
||||||
|
|
||||||
client.start()
|
client.start()
|
||||||
client.wait_for_unit("default.target")
|
client.wait_for_unit("default.target")
|
||||||
#client.succeed("nc -vz server 8080")
|
client.succeed("nc -vz server 8080")
|
||||||
'';
|
'';
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue