introduce config --no-env-resolution
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
This commit is contained in:
parent
0c5bd16da1
commit
a0d1c3f944
@ -47,6 +47,7 @@ type configOptions struct {
|
|||||||
noInterpolate bool
|
noInterpolate bool
|
||||||
noNormalize bool
|
noNormalize bool
|
||||||
noResolvePath bool
|
noResolvePath bool
|
||||||
|
noResolveEnv bool
|
||||||
services bool
|
services bool
|
||||||
volumes bool
|
volumes bool
|
||||||
profiles bool
|
profiles bool
|
||||||
@ -135,6 +136,7 @@ func configCommand(p *ProjectOptions, dockerCli command.Cli) *cobra.Command {
|
|||||||
flags.BoolVar(&opts.noNormalize, "no-normalize", false, "Don't normalize compose model")
|
flags.BoolVar(&opts.noNormalize, "no-normalize", false, "Don't normalize compose model")
|
||||||
flags.BoolVar(&opts.noResolvePath, "no-path-resolution", false, "Don't resolve file paths")
|
flags.BoolVar(&opts.noResolvePath, "no-path-resolution", false, "Don't resolve file paths")
|
||||||
flags.BoolVar(&opts.noConsistency, "no-consistency", false, "Don't check model consistency - warning: may produce invalid Compose output")
|
flags.BoolVar(&opts.noConsistency, "no-consistency", false, "Don't check model consistency - warning: may produce invalid Compose output")
|
||||||
|
flags.BoolVar(&opts.noResolveEnv, "no-env-resolution", false, "Don't resolve service env files")
|
||||||
|
|
||||||
flags.BoolVar(&opts.services, "services", false, "Print the service names, one per line.")
|
flags.BoolVar(&opts.services, "services", false, "Print the service names, one per line.")
|
||||||
flags.BoolVar(&opts.volumes, "volumes", false, "Print the volume names, one per line.")
|
flags.BoolVar(&opts.volumes, "volumes", false, "Print the volume names, one per line.")
|
||||||
@ -190,6 +192,13 @@ func runConfigInterpolate(ctx context.Context, dockerCli command.Cli, opts confi
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if !opts.noResolveEnv {
|
||||||
|
project, err = project.WithServicesEnvironmentResolved(true)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if !opts.noConsistency {
|
if !opts.noConsistency {
|
||||||
err := project.CheckContainerNameUnicity()
|
err := project.CheckContainerNameUnicity()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -19,6 +19,7 @@ the canonical format.
|
|||||||
| `--hash` | `string` | | Print the service config hash, one per line. |
|
| `--hash` | `string` | | Print the service config hash, one per line. |
|
||||||
| `--images` | `bool` | | Print the image names, one per line. |
|
| `--images` | `bool` | | Print the image names, one per line. |
|
||||||
| `--no-consistency` | `bool` | | Don't check model consistency - warning: may produce invalid Compose output |
|
| `--no-consistency` | `bool` | | Don't check model consistency - warning: may produce invalid Compose output |
|
||||||
|
| `--no-env-resolution` | `bool` | | Don't resolve service env files |
|
||||||
| `--no-interpolate` | `bool` | | Don't interpolate environment variables |
|
| `--no-interpolate` | `bool` | | Don't interpolate environment variables |
|
||||||
| `--no-normalize` | `bool` | | Don't normalize compose model |
|
| `--no-normalize` | `bool` | | Don't normalize compose model |
|
||||||
| `--no-path-resolution` | `bool` | | Don't resolve file paths |
|
| `--no-path-resolution` | `bool` | | Don't resolve file paths |
|
||||||
|
@ -59,6 +59,16 @@ options:
|
|||||||
experimentalcli: false
|
experimentalcli: false
|
||||||
kubernetes: false
|
kubernetes: false
|
||||||
swarm: false
|
swarm: false
|
||||||
|
- option: no-env-resolution
|
||||||
|
value_type: bool
|
||||||
|
default_value: "false"
|
||||||
|
description: Don't resolve service env files
|
||||||
|
deprecated: false
|
||||||
|
hidden: false
|
||||||
|
experimental: false
|
||||||
|
experimentalcli: false
|
||||||
|
kubernetes: false
|
||||||
|
swarm: false
|
||||||
- option: no-interpolate
|
- option: no-interpolate
|
||||||
value_type: bool
|
value_type: bool
|
||||||
default_value: "false"
|
default_value: "false"
|
||||||
|
@ -151,6 +151,9 @@ func applyRunOptions(project *types.Project, service *types.ServiceConfig, opts
|
|||||||
v, ok := envResolver(project.Environment)(s)
|
v, ok := envResolver(project.Environment)(s)
|
||||||
return v, ok
|
return v, ok
|
||||||
}).RemoveEmpty()
|
}).RemoveEmpty()
|
||||||
|
if service.Environment == nil {
|
||||||
|
service.Environment = types.MappingWithEquals{}
|
||||||
|
}
|
||||||
service.Environment.OverrideBy(serviceOverrideEnv)
|
service.Environment.OverrideBy(serviceOverrideEnv)
|
||||||
}
|
}
|
||||||
for k, v := range opts.Labels {
|
for k, v := range opts.Labels {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user