Add advanced Decodal example

This commit is contained in:
2026-06-16 10:04:44 +09:00
parent bd3da1aeee
commit 6316939438
4 changed files with 104 additions and 0 deletions
+47
View File
@@ -0,0 +1,47 @@
let
schema = import "./schema.dcdl";
profiles = import "./profiles.dcdl";
mkService = (cfg: schema.Service) =>
cfg // {
summary = match cfg.env {
"prod": "production service";
"dev": "development service";
_: "custom service";
};
};
devService = mkService(
profiles.base & {
name = "api-dev";
port = 8443;
}
);
prodService = mkService(
profiles.prod & {
name = "api";
port = 9443;
}
);
disabledService = mkService(
profiles.disabled & {
name = "api-disabled";
port = 10443;
}
);
in
{
services = [
devService,
prodService,
disabledService,
];
selected = match "prod" {
"prod": prodService;
"dev": devService;
_: disabledService;
};
}