Skip to content

Commit

Permalink
fix: init Globe core attributes earlier (#85)
Browse files Browse the repository at this point in the history
  • Loading branch information
Zebradil authored Sep 13, 2023
1 parent 976291e commit 20c48fd
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
15 changes: 8 additions & 7 deletions internal/myks/globe.go
Original file line number Diff line number Diff line change
Expand Up @@ -143,13 +143,6 @@ func New(rootDir string) *Globe {
if err := g.setGitRepoBranch(); err != nil {
log.Warn().Err(err).Msg("Unable to set git repo branch")
}
log.Debug().Interface("globe", g).Msg("Globe config")
return g
}

func (g *Globe) Init(asyncLevel int, searchPaths []string, applicationNames []string) error {
g.SearchPaths = searchPaths
g.ApplicationNames = applicationNames

yttLibraryDir := filepath.Join(g.RootDir, g.YttLibraryDirName)
if _, err := os.Stat(yttLibraryDir); err == nil {
Expand All @@ -164,6 +157,14 @@ func (g *Globe) Init(asyncLevel int, searchPaths []string, applicationNames []st
g.extraYttPaths = append(g.extraYttPaths, configFileName)
}

log.Debug().Interface("globe", g).Msg("Globe config")
return g
}

func (g *Globe) Init(asyncLevel int, searchPaths []string, applicationNames []string) error {
g.SearchPaths = searchPaths
g.ApplicationNames = applicationNames

g.collectEnvironments(searchPaths)

return process(asyncLevel, g.environments, func(item interface{}) error {
Expand Down
2 changes: 1 addition & 1 deletion internal/myks/smart_mode.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ func (g *Globe) InitSmartMode() ([]string, []string, error) {
err := process(0, g.environments, func(item interface{}) error {
env, ok := item.(*Environment)
if !ok {
return fmt.Errorf("unable to cast item to *Environment")
return fmt.Errorf("Unable to cast item to *Environment")
}
return env.initEnvData()
})
Expand Down

0 comments on commit 20c48fd

Please sign in to comment.