Skip to content

Commit

Permalink
name set in yaml is equivalent to --project-name
Browse files Browse the repository at this point in the history
Signed-off-by: Nicolas De Loof <[email protected]>
  • Loading branch information
ndeloof committed Dec 19, 2024
1 parent e3dffbf commit d52dad3
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions cli/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -482,6 +482,15 @@ func (o *ProjectOptions) prepare(ctx context.Context) (*types.ConfigDetails, err
return configDetails, err
}

if o.Name == "" {
// if any of the compose file is named, this is equivalent to user passing --project-name
for _, cfg := range configDetails.ConfigFiles {
if n, ok := cfg.Config["name"]; ok {
o.Name = fmt.Sprint(n)
}
}
}

o.loadOptions = append(o.loadOptions,
withNamePrecedenceLoad(defaultDir, o),
withConvertWindowsPaths(o),
Expand Down

0 comments on commit d52dad3

Please sign in to comment.