|
|
@ -60,27 +60,28 @@ func Configure(fname string, configSections string) (*SetupData, error) { |
|
|
|
Selected: fmt.Sprintf(`{{.Label}} {{ . | faint }}`), |
|
|
|
Selected: fmt.Sprintf(`{{.Label}} {{ . | faint }}`), |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// Environment selection
|
|
|
|
var selPrompt promptui.Select |
|
|
|
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 prompt promptui.Prompt |
|
|
|
var prompt promptui.Prompt |
|
|
|
|
|
|
|
|
|
|
|
if strings.Contains(configSections, "server") { |
|
|
|
if strings.Contains(configSections, "server") { |
|
|
|
title(" Server setup ") |
|
|
|
title(" Server setup ") |
|
|
|
fmt.Println() |
|
|
|
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 { |
|
|
|
if isDevEnv || !isStandalone { |
|
|
|
// Running in dev environment or behind reverse proxy; ask for port
|
|
|
|
// Running in dev environment or behind reverse proxy; ask for port
|
|
|
|
prompt = promptui.Prompt{ |
|
|
|
prompt = promptui.Prompt{ |
|
|
|