(f factory.Factory, client kubectl.Client, configPath string, configOptions *loader.ConfigOptions, resolveOptions dependency.ResolveOptions)
| 30 | } |
| 31 | |
| 32 | func LoadConfigWithOptionsAndResolve(f factory.Factory, client kubectl.Client, configPath string, configOptions *loader.ConfigOptions, resolveOptions dependency.ResolveOptions) (config.Config, []types.Dependency, error) { |
| 33 | before, err := os.Getwd() |
| 34 | if err != nil { |
| 35 | return nil, nil, err |
| 36 | } |
| 37 | defer SwitchDir(before) |
| 38 | |
| 39 | // Set config root |
| 40 | log := f.GetLog() |
| 41 | configLoader, err := f.NewConfigLoader(configPath) |
| 42 | if err != nil { |
| 43 | return nil, nil, err |
| 44 | } |
| 45 | configExists, err := configLoader.SetDevSpaceRoot(log) |
| 46 | if err != nil { |
| 47 | return nil, nil, err |
| 48 | } else if !configExists { |
| 49 | return nil, nil, errors.New(message.ConfigNotFound) |
| 50 | } |
| 51 | |
| 52 | // load config |
| 53 | loadedConfig, err := configLoader.Load(context.Background(), client, configOptions, log) |
| 54 | if err != nil { |
| 55 | return nil, nil, err |
| 56 | } |
| 57 | |
| 58 | // set devspacecontext |
| 59 | ctx := devspacecontext.NewContext(context.Background(), loadedConfig.Variables(), log).WithConfig(loadedConfig) |
| 60 | |
| 61 | // resolve dependencies |
| 62 | dependencies, err := dependency.NewManager(ctx, configOptions).ResolveAll(ctx, resolveOptions) |
| 63 | if err != nil { |
| 64 | return nil, nil, fmt.Errorf("error resolving dependencies: %v", err) |
| 65 | } |
| 66 | |
| 67 | return loadedConfig, dependencies, nil |
| 68 | } |
| 69 | |
| 70 | func LoadConfigWithOptions(f factory.Factory, client kubectl.Client, configPath string, configOptions *loader.ConfigOptions) (config.Config, []types.Dependency, error) { |
| 71 | return LoadConfigWithOptionsAndResolve(f, client, configPath, configOptions, dependency.ResolveOptions{}) |
no test coverage detected