LoadService produces a single ServiceConfig from a compose file Dict the serviceDict is not validated if directly used. Use Load() to enable validation
(name string, serviceDict map[string]any, workingDir string, lookupEnv template.Mapping)
| 409 | // LoadService produces a single ServiceConfig from a compose file Dict |
| 410 | // the serviceDict is not validated if directly used. Use Load() to enable validation |
| 411 | func LoadService(name string, serviceDict map[string]any, workingDir string, lookupEnv template.Mapping) (*types.ServiceConfig, error) { |
| 412 | serviceConfig := &types.ServiceConfig{} |
| 413 | if err := Transform(serviceDict, serviceConfig); err != nil { |
| 414 | return nil, err |
| 415 | } |
| 416 | serviceConfig.Name = name |
| 417 | |
| 418 | if err := resolveEnvironment(serviceConfig, workingDir, lookupEnv); err != nil { |
| 419 | return nil, err |
| 420 | } |
| 421 | |
| 422 | if err := resolveVolumePaths(serviceConfig.Volumes, workingDir, lookupEnv); err != nil { |
| 423 | return nil, err |
| 424 | } |
| 425 | |
| 426 | serviceConfig.Extras = getExtras(serviceDict) |
| 427 | |
| 428 | return serviceConfig, nil |
| 429 | } |
| 430 | |
| 431 | func loadExtras(name string, source map[string]any) map[string]any { |
| 432 | if dict, ok := source[name].(map[string]any); ok { |
no test coverage detected
searching dependent graphs…