feat: auto-deploy traefik prototype
All checks were successful
continuous-integration/drone/push Build is passing

Closes coop-cloud/organising#212.
This commit is contained in:
2021-11-03 09:41:20 +01:00
parent c227972c12
commit 04e24022f5
3 changed files with 43 additions and 10 deletions

View File

@ -72,7 +72,7 @@ func createSecrets(sanitisedAppName string) (AppSecrets, error) {
// ensureDomainFlag checks if the domain flag was used. if not, asks the user for it/
func ensureDomainFlag(recipe recipe.Recipe, server string) error {
if Domain == "" {
if Domain == "" && !NoInput {
prompt := &survey.Input{
Message: "Specify app domain",
Default: fmt.Sprintf("%s.%s", recipe.Name, server),
@ -81,6 +81,11 @@ func ensureDomainFlag(recipe recipe.Recipe, server string) error {
return err
}
}
if Domain == "" {
return fmt.Errorf("no domain provided")
}
return nil
}
@ -91,7 +96,7 @@ func ensureServerFlag() error {
return err
}
if NewAppServer == "" {
if NewAppServer == "" && !NoInput {
prompt := &survey.Select{
Message: "Select app server:",
Options: servers,
@ -101,12 +106,16 @@ func ensureServerFlag() error {
}
}
if NewAppServer == "" {
return fmt.Errorf("no server provided")
}
return nil
}
// ensureServerFlag checks if the AppName flag was used. if not, asks the user for it.
func ensureAppNameFlag() error {
if NewAppName == "" {
if NewAppName == "" && !NoInput {
prompt := &survey.Input{
Message: "Specify app name:",
Default: config.SanitiseAppName(Domain),
@ -115,6 +124,11 @@ func ensureAppNameFlag() error {
return err
}
}
if NewAppName == "" {
return fmt.Errorf("no app name provided")
}
return nil
}
@ -174,7 +188,7 @@ func NewAction(c *cli.Context) error {
table.Append([]string{sanitisedAppName, Domain, recipe.Name, NewAppServer})
fmt.Println("")
fmt.Println(fmt.Sprintf("New '%s' created! Here is your new app overview:", recipe.Name))
fmt.Println(fmt.Sprintf("A new %s app has been created! Here is an overview:", recipe.Name))
fmt.Println("")
table.Render()
fmt.Println("")