66 "kool-dev/kool/core/environment"
77 "kool-dev/kool/services/cloud"
88 "kool-dev/kool/services/cloud/api"
9+ "kool-dev/kool/services/cloud/setup"
910 "kool-dev/kool/services/tgz"
1011 "os"
1112 "path/filepath"
@@ -17,8 +18,7 @@ import (
1718)
1819
1920const (
20- koolDeployEnv = "kool.deploy.env"
21- koolDeployFile = "kool.cloud.yml"
21+ koolDeployEnv = "kool.deploy.env"
2222)
2323
2424// KoolCloudDeployFlags holds the flags for the kool cloud deploy command
@@ -37,9 +37,10 @@ type KoolCloudDeployFlags struct {
3737type KoolDeploy struct {
3838 DefaultKoolService
3939
40- flags * KoolCloudDeployFlags
41- env environment.EnvStorage
42- git builder.Command
40+ setupParser setup.CloudSetupParser
41+ flags * KoolCloudDeployFlags
42+ env environment.EnvStorage
43+ git builder.Command
4344}
4445
4546// NewDeployCommand initializes new kool deploy Cobra command
@@ -65,10 +66,12 @@ func NewDeployCommand(deploy *KoolDeploy) (cmd *cobra.Command) {
6566// NewKoolDeploy creates a new pointer with default KoolDeploy service
6667// dependencies.
6768func NewKoolDeploy () * KoolDeploy {
69+ env := environment .NewEnvStorage ()
6870 return & KoolDeploy {
6971 * newDefaultKoolService (),
72+ setup .NewDefaultCloudSetupParser (env .Get ("PWD" )),
7073 & KoolCloudDeployFlags {},
71- environment . NewEnvStorage () ,
74+ env ,
7275 builder .NewCommand ("git" ),
7376 }
7477}
@@ -275,13 +278,13 @@ func (d *KoolDeploy) handleDeployEnv(files []string) []string {
275278}
276279
277280func (d * KoolDeploy ) validate () (err error ) {
278- if err = cloud .ValidateKoolDeployFile (d .env .Get ("PWD" ), koolDeployFile ); err != nil {
281+ if err = cloud .ValidateKoolDeployFile (d .env .Get ("PWD" ), setup . KoolDeployFile ); err != nil {
279282 return
280283 }
281284
282285 // if no domain is set, we try to get it from the environment
283286 if d .flags .DeployDomain == "" && d .env .Get ("KOOL_DEPLOY_DOMAIN" ) == "" {
284- err = fmt .Errorf ("Missing deploy domain. Please set it via --domain or KOOL_DEPLOY_DOMAIN environment variable. " )
287+ err = fmt .Errorf ("missing deploy domain - please set it via --domain or KOOL_DEPLOY_DOMAIN environment variable" )
285288 return
286289 } else if d .flags .DeployDomain != "" {
287290 // shares the flag via environment variable
@@ -290,7 +293,7 @@ func (d *KoolDeploy) validate() (err error) {
290293
291294 // if no token is set, we try to get it from the environment
292295 if d .flags .Token == "" && d .env .Get ("KOOL_API_TOKEN" ) == "" {
293- err = fmt .Errorf ("Missing Kool Cloud API token. Please set it via --token or KOOL_API_TOKEN environment variable. " )
296+ err = fmt .Errorf ("missing Kool Cloud API token - please set it via --token or KOOL_API_TOKEN environment variable" )
294297 return
295298 } else if d .flags .Token != "" {
296299 d .env .Set ("KOOL_API_TOKEN" , d .flags .Token )
0 commit comments