File tree Expand file tree Collapse file tree 1 file changed +8
-6
lines changed Expand file tree Collapse file tree 1 file changed +8
-6
lines changed Original file line number Diff line number Diff line change @@ -215,14 +215,16 @@ func WithLoadOptions(loadOptions ...func(*loader.Options)) ProjectOptionsFn {
215215
216216// WithDefaultProfiles uses the provided profiles (if any), and falls back to
217217// profiles specified via the COMPOSE_PROFILES environment variable otherwise.
218- func WithDefaultProfiles (profile ... string ) ProjectOptionsFn {
219- if len (profile ) == 0 {
220- for _ , s := range strings .Split (os .Getenv (consts .ComposeProfiles ), "," ) {
221- profile = append (profile , strings .TrimSpace (s ))
218+ func WithDefaultProfiles (profiles ... string ) ProjectOptionsFn {
219+ return func (o * ProjectOptions ) error {
220+ if len (profiles ) == 0 {
221+ for _ , s := range strings .Split (o .Environment [consts .ComposeProfiles ], "," ) {
222+ profiles = append (profiles , strings .TrimSpace (s ))
223+ }
222224 }
223-
225+ o .loadOptions = append (o .loadOptions , loader .WithProfiles (profiles ))
226+ return nil
224227 }
225- return WithProfiles (profile )
226228}
227229
228230// WithProfiles sets profiles to be activated
You can’t perform that action at this time.
0 commit comments