LoadProject implements api.Compose.LoadProject It loads and validates a Compose project from configuration files.
(ctx context.Context, options api.ProjectLoadOptions)
| 34 | // LoadProject implements api.Compose.LoadProject |
| 35 | // It loads and validates a Compose project from configuration files. |
| 36 | func (s *composeService) LoadProject(ctx context.Context, options api.ProjectLoadOptions) (*types.Project, error) { |
| 37 | // Setup remote loaders (Git, OCI) |
| 38 | remoteLoaders := s.createRemoteLoaders(options) |
| 39 | |
| 40 | projectOptions, err := s.buildProjectOptions(options, remoteLoaders) |
| 41 | if err != nil { |
| 42 | return nil, err |
| 43 | } |
| 44 | |
| 45 | // Register all user-provided listeners (e.g., for metrics collection) |
| 46 | for _, listener := range options.LoadListeners { |
| 47 | if listener != nil { |
| 48 | projectOptions.WithListeners(listener) |
| 49 | } |
| 50 | } |
| 51 | |
| 52 | if options.Compatibility || utils.StringToBool(projectOptions.Environment[api.ComposeCompatibility]) { |
| 53 | api.Separator = "_" |
| 54 | } |
| 55 | |
| 56 | project, err := projectOptions.LoadProject(ctx) |
| 57 | if err != nil { |
| 58 | return nil, err |
| 59 | } |
| 60 | |
| 61 | // Post-processing: service selection, environment resolution, etc. |
| 62 | project, err = s.postProcessProject(project, options) |
| 63 | if err != nil { |
| 64 | return nil, err |
| 65 | } |
| 66 | |
| 67 | return project, nil |
| 68 | } |
| 69 | |
| 70 | // createRemoteLoaders creates Git and OCI remote loaders if not in offline mode |
| 71 | func (s *composeService) createRemoteLoaders(options api.ProjectLoadOptions) []loader.ResourceLoader { |
nothing calls this directly
no test coverage detected