Define module for detailed depends_on options

This commit is contained in:
t4ccer 2022-04-27 14:23:25 -06:00
parent cf20442a7a
commit 69b9109dea
No known key found for this signature in database
GPG key ID: 19E5A2D8B1E43F19
2 changed files with 16 additions and 6 deletions

View file

@ -514,7 +514,7 @@ See link:https://docs.docker.com/compose/compose-file/#depends_on[Docker Compose
[discrete]
=== details
Type:: list of strings or attribute set of attribute set of stringss
Type:: list of strings or attribute set of submodules
Default::
+
----

View file

@ -8,7 +8,7 @@
let
inherit (lib) mkOption types;
inherit (types) listOf nullOr attrsOf str either int bool;
inherit (types) listOf nullOr attrsOf str either int bool submodule enum;
link = url: text:
''link:${url}[${text}]'';
@ -100,10 +100,20 @@ in
default = null;
description = dockerComposeRef "container_name";
};
service.depends_on = mkOption {
type = either (listOf str) (attrsOf (attrsOf str));
default = [];
description = dockerComposeRef "depends_on";
service.depends_on =
let conditionsModule = {
options = {
condition = mkOption {
type = enum ["service_started" "service_healthy" "service_completed_successfully"];
description = dockerComposeRef "depends_on";
default = "service_started";
};
};
};
in mkOption {
type = either (listOf str) (attrsOf (submodule conditionsModule));
default = [];
description = dockerComposeRef "depends_on";
};
service.healthcheck.test = mkOption {
type = nullOr (listOf str);