From b8b15c85500688d41eaae6d28d80e02d1bddc657 Mon Sep 17 00:00:00 2001 From: Matt Baer Date: Mon, 1 Jul 2019 14:00:56 -0400 Subject: [PATCH] Move Environment prompt back under Server section --- config/setup.go | 31 ++++++++++++++++--------------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/config/setup.go b/config/setup.go index ec4c368..b1c0c37 100644 --- a/config/setup.go +++ b/config/setup.go @@ -60,27 +60,28 @@ func Configure(fname string, configSections string) (*SetupData, error) { Selected: fmt.Sprintf(`{{.Label}} {{ . | faint }}`), } - // Environment selection - selPrompt := promptui.Select{ - Templates: selTmpls, - Label: "Environment", - Items: []string{"Development", "Production, standalone", "Production, behind reverse proxy"}, - } - _, envType, err := selPrompt.Run() - if err != nil { - return data, err - } - isDevEnv := envType == "Development" - isStandalone := envType == "Production, standalone" - - data.Config.Server.Dev = isDevEnv - + var selPrompt promptui.Select var prompt promptui.Prompt if strings.Contains(configSections, "server") { title(" Server setup ") fmt.Println() + // Environment selection + selPrompt = promptui.Select{ + Templates: selTmpls, + Label: "Environment", + Items: []string{"Development", "Production, standalone", "Production, behind reverse proxy"}, + } + _, envType, err := selPrompt.Run() + if err != nil { + return data, err + } + isDevEnv := envType == "Development" + isStandalone := envType == "Production, standalone" + + data.Config.Server.Dev = isDevEnv + if isDevEnv || !isStandalone { // Running in dev environment or behind reverse proxy; ask for port prompt = promptui.Prompt{