Skip to content

Commit

Permalink
fix: fix issue where skip parameter was not considered in authenticat…
Browse files Browse the repository at this point in the history
…ion validation pre config
  • Loading branch information
tomazpu committed Oct 21, 2024
1 parent 3a052d8 commit bb8a110
Showing 1 changed file with 20 additions and 7 deletions.
27 changes: 20 additions & 7 deletions cmd/monaco/deploy/deploy.go
Original file line number Diff line number Diff line change
Expand Up @@ -249,22 +249,35 @@ func platformEnvironment(e manifest.EnvironmentDefinition) bool {
}

func validateAuthenticationWithProjectConfigs(projects []project.Project, loadedManifest *manifest.Manifest) error {
var err error
for _, p := range projects {
p.ForEveryConfigDo(func(c config.Config) {
for envName, env := range p.Configs {
for _, conf := range env {
switch conf[0].Type.(type) {
case config.ClassicApiType:
if loadedManifest.Environments[envName].Auth.Token == nil && conf[0].Skip == false {
return fmt.Errorf("API: %s requires token", conf[0].Type)
}
default:
if loadedManifest.Environments[envName].Auth.OAuth == nil && conf[0].Skip == false {
return fmt.Errorf("API: %s requires oAuth", conf[0].Type)
}
}
}
}
/*p.ForEveryConfigDo(func(c config.Config) {
switch c.Type.(type) {
case config.ClassicApiType:
if loadedManifest.Environments[c.Environment].Auth.Token == nil {
if loadedManifest.Environments[c.Environment].Auth.Token == nil && c.Skip == false {
err = fmt.Errorf("API: %s requires token", c.Type)
return
}
default:
if loadedManifest.Environments[c.Environment].Auth.OAuth == nil {
err = fmt.Errorf("API: %s requires oAuth", c.Type)
if loadedManifest.Environments[c.Environment].Auth.OAuth == nil && c.Skip == false {
err = fmt.Errorf("API: %v requires oAuth", c.Type)
return
}
}
})
})*/
}
return err
return nil
}

0 comments on commit bb8a110

Please sign in to comment.