feat: support better domain defaults
continuous-integration/drone/push Build is passing Details

Closes coop-cloud/organising#221.
This commit is contained in:
decentral1se 2021-11-02 14:44:16 +01:00
parent f2b02e39a7
commit ab02c5f0dd
No known key found for this signature in database
GPG Key ID: 5E2EF5A63E3718CC
1 changed files with 4 additions and 2 deletions

View File

@ -8,6 +8,7 @@ import (
"coopcloud.tech/abra/cli/internal"
"coopcloud.tech/abra/pkg/catalogue"
"coopcloud.tech/abra/pkg/config"
"coopcloud.tech/abra/pkg/recipe"
"coopcloud.tech/abra/pkg/secret"
"github.com/AlecAivazis/survey/v2"
"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/
func ensureDomainFlag() error {
func ensureDomainFlag(recipe recipe.Recipe, server string) error {
if domain == "" {
prompt := &survey.Input{
Message: "Specify app domain",
Default: fmt.Sprintf("%s.%s", recipe.Name, server),
}
if err := survey.AskOne(prompt, &domain); err != nil {
return err
@ -175,7 +177,7 @@ func action(c *cli.Context) error {
logrus.Fatal(err)
}
if err := ensureDomainFlag(); err != nil {
if err := ensureDomainFlag(recipe, newAppServer); err != nil {
logrus.Fatal(err)
}