mirror of
https://github.com/docker/compose.git
synced 2025-09-25 10:47:54 +02:00
only load COMPOSE_* from $PWD/.env
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
This commit is contained in:
parent
7cd569922e
commit
b387ba4a05
@ -693,7 +693,7 @@ func setEnvWithDotEnv(opts ProjectOptions) error {
|
||||
return nil
|
||||
}
|
||||
for k, v := range envFromFile {
|
||||
if _, ok := os.LookupEnv(k); !ok {
|
||||
if _, ok := os.LookupEnv(k); !ok && strings.HasPrefix(k, "COMPOSE_") {
|
||||
if err = os.Setenv(k, v); err != nil {
|
||||
return nil
|
||||
}
|
||||
|
@ -120,8 +120,8 @@ func (options runOptions) apply(project *types.Project) (*types.Project, error)
|
||||
return project, nil
|
||||
}
|
||||
|
||||
func (options runOptions) getEnvironment() (types.Mapping, error) {
|
||||
environment := types.NewMappingWithEquals(options.environment).Resolve(os.LookupEnv).ToMapping()
|
||||
func (options runOptions) getEnvironment(resolve func(string) (string, bool)) (types.Mapping, error) {
|
||||
environment := types.NewMappingWithEquals(options.environment).Resolve(resolve).ToMapping()
|
||||
for _, file := range options.envFiles {
|
||||
f, err := os.Open(file)
|
||||
if err != nil {
|
||||
@ -289,7 +289,7 @@ func runRun(ctx context.Context, backend api.Service, project *types.Project, op
|
||||
buildForRun = &bo
|
||||
}
|
||||
|
||||
environment, err := options.getEnvironment()
|
||||
environment, err := options.getEnvironment(project.Environment.Resolve)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user