mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-27 17:33:09 +00:00
nixos/oci-containers: add support for environment files
This commit is contained in:
parent
7bf3b1fe95
commit
f5922de1d7
@ -59,6 +59,18 @@ let
|
|||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
|
environmentFiles = mkOption {
|
||||||
|
type = with types; listOf path;
|
||||||
|
default = [];
|
||||||
|
description = "Environment files for this container.";
|
||||||
|
example = literalExample ''
|
||||||
|
[
|
||||||
|
/path/to/.env
|
||||||
|
/path/to/.env.secret
|
||||||
|
]
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
log-driver = mkOption {
|
log-driver = mkOption {
|
||||||
type = types.str;
|
type = types.str;
|
||||||
default = "journald";
|
default = "journald";
|
||||||
@ -236,6 +248,7 @@ let
|
|||||||
] ++ optional (container.entrypoint != null)
|
] ++ optional (container.entrypoint != null)
|
||||||
"--entrypoint=${escapeShellArg container.entrypoint}"
|
"--entrypoint=${escapeShellArg container.entrypoint}"
|
||||||
++ (mapAttrsToList (k: v: "-e ${escapeShellArg k}=${escapeShellArg v}") container.environment)
|
++ (mapAttrsToList (k: v: "-e ${escapeShellArg k}=${escapeShellArg v}") container.environment)
|
||||||
|
++ map (f: "--env-file ${escapeShellArg f}") container.environmentFiles
|
||||||
++ map (p: "-p ${escapeShellArg p}") container.ports
|
++ map (p: "-p ${escapeShellArg p}") container.ports
|
||||||
++ optional (container.user != null) "-u ${escapeShellArg container.user}"
|
++ optional (container.user != null) "-u ${escapeShellArg container.user}"
|
||||||
++ map (v: "-v ${escapeShellArg v}") container.volumes
|
++ map (v: "-v ${escapeShellArg v}") container.volumes
|
||||||
|
Loading…
Reference in New Issue
Block a user