feat: support better domain defaults
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
Closes coop-cloud/organising#221.
This commit is contained in:
parent
f2b02e39a7
commit
ab02c5f0dd
@ -8,6 +8,7 @@ import (
|
|||||||
"coopcloud.tech/abra/cli/internal"
|
"coopcloud.tech/abra/cli/internal"
|
||||||
"coopcloud.tech/abra/pkg/catalogue"
|
"coopcloud.tech/abra/pkg/catalogue"
|
||||||
"coopcloud.tech/abra/pkg/config"
|
"coopcloud.tech/abra/pkg/config"
|
||||||
|
"coopcloud.tech/abra/pkg/recipe"
|
||||||
"coopcloud.tech/abra/pkg/secret"
|
"coopcloud.tech/abra/pkg/secret"
|
||||||
"github.com/AlecAivazis/survey/v2"
|
"github.com/AlecAivazis/survey/v2"
|
||||||
"github.com/sirupsen/logrus"
|
"github.com/sirupsen/logrus"
|
||||||
@ -92,10 +93,11 @@ var appNewCommand = &cli.Command{
|
|||||||
}
|
}
|
||||||
|
|
||||||
// ensureDomainFlag checks if the domain flag was used. if not, asks the user for it/
|
// ensureDomainFlag checks if the domain flag was used. if not, asks the user for it/
|
||||||
func ensureDomainFlag() error {
|
func ensureDomainFlag(recipe recipe.Recipe, server string) error {
|
||||||
if domain == "" {
|
if domain == "" {
|
||||||
prompt := &survey.Input{
|
prompt := &survey.Input{
|
||||||
Message: "Specify app domain",
|
Message: "Specify app domain",
|
||||||
|
Default: fmt.Sprintf("%s.%s", recipe.Name, server),
|
||||||
}
|
}
|
||||||
if err := survey.AskOne(prompt, &domain); err != nil {
|
if err := survey.AskOne(prompt, &domain); err != nil {
|
||||||
return err
|
return err
|
||||||
@ -175,7 +177,7 @@ func action(c *cli.Context) error {
|
|||||||
logrus.Fatal(err)
|
logrus.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := ensureDomainFlag(); err != nil {
|
if err := ensureDomainFlag(recipe, newAppServer); err != nil {
|
||||||
logrus.Fatal(err)
|
logrus.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user