mirror of
https://github.com/NixOS/nixpkgs.git
synced 2026-07-06 17:13:24 -05:00
nixos/ersatztv: fix mismatch between environment type firewall port
services.ersatztv.environment must not have number types, but networking.firewall.allowedTCPPorts must be an integer Updates nixosTests.ersatztv to test setting new UI port
This commit is contained in:
parent
ca4316aadf
commit
8a26a5c546
2 changed files with 33 additions and 7 deletions
|
|
@ -20,12 +20,14 @@ let
|
|||
bool
|
||||
float
|
||||
int
|
||||
package
|
||||
;
|
||||
cfg = config.services.ersatztv;
|
||||
defaultEnv = {
|
||||
ETV_UI_PORT = 8409;
|
||||
ETV_BASE_URL = "/";
|
||||
};
|
||||
|
||||
in
|
||||
{
|
||||
options = {
|
||||
|
|
@ -54,6 +56,8 @@ in
|
|||
int
|
||||
float
|
||||
bool
|
||||
path
|
||||
package
|
||||
]);
|
||||
default = defaultEnv;
|
||||
example = {
|
||||
|
|
@ -108,7 +112,7 @@ in
|
|||
ETV_CONFIG_FOLDER = "/var/lib/ersatztv/config";
|
||||
ETV_TRANSCODE_FOLDER = "/var/lib/ersatztv/transcode";
|
||||
}
|
||||
// cfg.environment;
|
||||
// (lib.mapAttrs (_: s: if lib.isBool s then lib.boolToString s else toString s) cfg.environment);
|
||||
};
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -4,16 +4,38 @@
|
|||
name = "ersatztv";
|
||||
meta.maintainers = with lib.maintainers; [ allout58 ];
|
||||
|
||||
nodes.machine =
|
||||
nodes.basic =
|
||||
{ ... }:
|
||||
{
|
||||
services.ersatztv.enable = true;
|
||||
};
|
||||
nodes.reconfigured =
|
||||
{ ... }:
|
||||
{
|
||||
services.ersatztv.enable = true;
|
||||
services.ersatztv.environment.ETV_UI_PORT = 8123;
|
||||
services.ersatztv.openFirewall = true;
|
||||
};
|
||||
|
||||
# ErsatzTV doesn't really have an API to speak of currently, so just check if it responds at all
|
||||
testScript = ''
|
||||
machine.wait_for_unit("ersatztv.service")
|
||||
machine.wait_for_open_port(8409)
|
||||
machine.succeed("curl --fail http://localhost:8409/")
|
||||
'';
|
||||
testScript =
|
||||
{ nodes, ... }:
|
||||
let
|
||||
basicIp = (lib.head nodes.basic.networking.interfaces.eth1.ipv4.addresses).address;
|
||||
reconfiguredIp = (lib.head nodes.reconfigured.networking.interfaces.eth1.ipv4.addresses).address;
|
||||
in
|
||||
''
|
||||
start_all()
|
||||
basic.wait_for_unit("ersatztv.service")
|
||||
basic.wait_for_open_port(8409)
|
||||
basic.succeed("curl --fail http://localhost:8409/api/sessions")
|
||||
|
||||
reconfigured.wait_for_unit("ersatztv.service")
|
||||
reconfigured.wait_for_open_port(8123)
|
||||
reconfigured.succeed("curl --fail http://localhost:8123/api/sessions")
|
||||
|
||||
# Test that the firewall is open
|
||||
reconfigured.fail("curl --fail --connect-timeout 5 http://${basicIp}:8409/api/sessions")
|
||||
basic.succeed("curl --fail http://${reconfiguredIp}:8123/api/sessions")
|
||||
'';
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue