Skip to content

Commit

Permalink
Merge pull request #464 from kool-dev/kool_deploy_tweaks
Browse files Browse the repository at this point in the history
Kool Cloud Tweak
  • Loading branch information
dbpolito authored May 9, 2023
2 parents 3b5acab + 18f05d0 commit e23ffca
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 12 deletions.
2 changes: 1 addition & 1 deletion commands/cloud_deploy.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import (

const (
koolDeployEnv = "kool.deploy.env"
koolDeployFile = "kool.deploy.yml"
koolDeployFile = "kool.cloud.yml"
)

// KoolDeploy holds handlers and functions for using Deploy API
Expand Down
20 changes: 9 additions & 11 deletions services/cloud/deploy_validator.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,15 @@ func ValidateKoolDeployFile(workingDir string, koolDeployFile string) (err error
path = filepath.Join(workingDir, koolDeployFile)

if _, err = os.Stat(path); os.IsNotExist(err) {
err = fmt.Errorf("could not find required file (%s) on current working directory", koolDeployFile)
// temporary failback to old file name
path = filepath.Join(workingDir, "kool.deploy.yml")

if _, err = os.Stat(path); os.IsNotExist(err) {
err = fmt.Errorf("could not find required file (%s) on current working directory", "kool.cloud.yml")
return
} else if err != nil {
return
}
return
} else if err != nil {
return
Expand All @@ -52,7 +60,6 @@ func ValidateKoolDeployFile(workingDir string, koolDeployFile string) (err error
return
}

var gotPublicService = false
for service, config := range deployConfig.Services {
// validates build file exists if defined
if config.Build != nil {
Expand All @@ -67,15 +74,6 @@ func ValidateKoolDeployFile(workingDir string, koolDeployFile string) (err error

// validates only one service can be public, and it must define a port
if config.Public != nil {
// this is a public service
if gotPublicService {
// we can have only the one!
err = fmt.Errorf("service (%s) is public, but another service is already public", service)
return
}

gotPublicService = true

// being public, it must define the `port` entry as well
if config.Port == nil {
err = fmt.Errorf("service (%s) is public, but it does not define the `port` entry", service)
Expand Down

0 comments on commit e23ffca

Please sign in to comment.