Skip to content

Commit

Permalink
feat: fail on non existing apps. Warn for typos
Browse files Browse the repository at this point in the history
Now it fails, if some configuration error happened (configured app does not exist).
Ignore missing applications if provided via commandline.
Might be a typo or the application is only configured for some envs.
  • Loading branch information
kbudde committed Aug 19, 2023
1 parent 144f5fd commit 563e8cb
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions internal/myks/environment.go
Original file line number Diff line number Diff line change
Expand Up @@ -258,16 +258,19 @@ func (e *Environment) initApplications(applicationNames []string) error {
for name, proto := range e.foundApplications {
app, err := NewApplication(e, name, proto)
if err != nil {
log.Warn().Err(err).Str("dir", e.Dir).Interface("app", name).Msg(e.Msg("Unable to initialize application"))
return fmt.Errorf("unable to initialize application %s for env %s. Err: %w", name, e.Dir, err)
} else {
e.Applications = append(e.Applications, app)
}
}
return nil
}
// applicationNames provided via commandline. Be more friendly
for _, appName := range applicationNames {
proto := e.foundApplications[appName]
if proto == "" {
return errors.New("Application not found: " + appName)
log.Warn().Str("dir", e.Dir).Interface("app", appName).Msg(e.Msg("Application not found"))
continue
}
app, err := NewApplication(e, appName, proto)
if err != nil {
Expand Down

0 comments on commit 563e8cb

Please sign in to comment.