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 {
215
215
216
216
// WithDefaultProfiles uses the provided profiles (if any), and falls back to
217
217
// 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
+ }
222
224
}
223
-
225
+ o .loadOptions = append (o .loadOptions , loader .WithProfiles (profiles ))
226
+ return nil
224
227
}
225
- return WithProfiles (profile )
226
228
}
227
229
228
230
// WithProfiles sets profiles to be activated
You can’t perform that action at this time.
0 commit comments