mirror of
				https://github.com/docker/compose.git
				synced 2025-11-03 21:25:21 +01:00 
			
		
		
		
	Merge pull request #9906 from glours/profiles-priority
use COMPOSE_PROFILES value only if no command line arg profiles used
This commit is contained in:
		
						commit
						c53539e1cc
					
				@ -209,6 +209,10 @@ func (o *projectOptions) toProject(services []string, po ...cli.ProjectOptionsFn
 | 
				
			|||||||
		project.Services[i] = s
 | 
							project.Services[i] = s
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						if profiles, ok := options.Environment["COMPOSE_PROFILES"]; ok && len(o.Profiles) == 0 {
 | 
				
			||||||
 | 
							o.Profiles = append(o.Profiles, strings.Split(profiles, ",")...)
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if len(services) > 0 {
 | 
						if len(services) > 0 {
 | 
				
			||||||
		s, err := project.GetServices(services...)
 | 
							s, err := project.GetServices(services...)
 | 
				
			||||||
		if err != nil {
 | 
							if err != nil {
 | 
				
			||||||
@ -217,10 +221,6 @@ func (o *projectOptions) toProject(services []string, po ...cli.ProjectOptionsFn
 | 
				
			|||||||
		o.Profiles = append(o.Profiles, s.GetProfiles()...)
 | 
							o.Profiles = append(o.Profiles, s.GetProfiles()...)
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if profiles, ok := options.Environment["COMPOSE_PROFILES"]; ok {
 | 
					 | 
				
			||||||
		o.Profiles = append(o.Profiles, strings.Split(profiles, ",")...)
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	project.ApplyProfiles(o.Profiles)
 | 
						project.ApplyProfiles(o.Profiles)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	project.WithoutUnnecessaryResources()
 | 
						project.WithoutUnnecessaryResources()
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user