fix: skip prompt for no passwords

This commit is contained in:
decentral1se 2022-03-15 10:54:05 +01:00
parent 7f315315f0
commit 1615130929
Signed by untrusted user: decentral1se
GPG Key ID: 03789458B3D0C410

View File

@ -4,6 +4,7 @@ import (
"fmt"
"path"
"coopcloud.tech/abra/pkg/app"
"coopcloud.tech/abra/pkg/config"
"coopcloud.tech/abra/pkg/formatter"
"coopcloud.tech/abra/pkg/recipe"
@ -67,7 +68,18 @@ func ensureDomainFlag(recipe recipe.Recipe, server string) error {
}
// promptForSecrets asks if we should generate secrets for a new app.
func promptForSecrets() error {
func promptForSecrets(appName string) error {
app, err := app.Get(appName)
if err != nil {
return err
}
secretEnvVars := secret.ReadSecretEnvVars(app.Env)
if len(secretEnvVars) == 0 {
logrus.Debugf("%s has no secrets to generate, skipping...", app.Recipe)
return nil
}
if !Secrets && !NoInput {
prompt := &survey.Confirm{
Message: "Generate app secrets?",
@ -120,7 +132,7 @@ func NewAction(c *cli.Context) error {
logrus.Fatal(err)
}
if err := promptForSecrets(); err != nil {
if err := promptForSecrets(Domain); err != nil {
logrus.Fatal(err)
}