fix(lib/k8s): fix mkSecretOption

This commit is contained in:
Jaka Hudoklin 2020-01-14 20:43:47 +00:00
parent 33d797dae8
commit ccb1b8e538
No known key found for this signature in database
GPG key ID: 11AA2A62319E4968

View file

@ -3,25 +3,27 @@
with lib; with lib;
rec { rec {
mkSecretOption = {description ? "", default ? null}: mkOption { mkSecretOption = {description ? "", default ? {}}: mkOption ({
inherit description; inherit description;
type = types.nullOr (types.submodule { type = types.nullOr (types.submodule {
options = { options = {
name = mkOption { name = mkOption {
description = "Name of the secret where secret is stored"; description = "Name of the secret where secret is stored";
type = types.str; type = types.str;
default = default.name or null;
}; };
key = mkOption { key = mkOption {
description = "Name of the key where secret is stored"; description = "Name of the key where secret is stored";
type = types.str; type = types.str;
default = default.key or null;
}; };
}; };
config = mkDefault (if default == null then {} else default);
}); });
default = default; default = {};
}; } // (optionalAttrs (default == null) {
default = null;
}));
secretToEnv = value: { secretToEnv = value: {
valueFrom.secretKeyRef = { valueFrom.secretKeyRef = {