Add service.dns

This commit is contained in:
lunik1 2021-04-10 00:51:40 +01:00
parent 0417272e0e
commit aed2c40e77
No known key found for this signature in database
GPG key ID: 6A37DF9483188492
2 changed files with 10 additions and 0 deletions

View file

@ -2,6 +2,8 @@
## Next ## Next
* Support `service.dns`, for overriding the DNS servers used by containers.
* Support `service.labels`, which is useful for autodiscovery among other things. * Support `service.labels`, which is useful for autodiscovery among other things.
* Add a tested example for Traefik with label-based routing. * Add a tested example for Traefik with label-based routing.

View file

@ -115,6 +115,12 @@ in
${dockerComposeRef "devices"} ${dockerComposeRef "devices"}
''; '';
}; };
service.dns = mkOption {
type = listOf str;
default = [];
example = [ "8.8.8.8" "8.8.4.4" ];
description = dockerComposeRef "dns";
};
service.labels = mkOption { service.labels = mkOption {
type = attrsOf str; type = attrsOf str;
default = {}; default = {};
@ -258,6 +264,8 @@ in
inherit (config.service) extra_hosts; inherit (config.service) extra_hosts;
} // lib.optionalAttrs (config.service.hostname != null) { } // lib.optionalAttrs (config.service.hostname != null) {
inherit (config.service) hostname; inherit (config.service) hostname;
} // lib.optionalAttrs (config.service.dns != []) {
inherit (config.service) dns;
} // lib.optionalAttrs (config.service.labels != {}) { } // lib.optionalAttrs (config.service.labels != {}) {
inherit (config.service) labels; inherit (config.service) labels;
} // lib.optionalAttrs (config.service.links != []) { } // lib.optionalAttrs (config.service.links != []) {