Skip to content

Commit 7b398c8

Browse files
committed
adjustments
1 parent b76ef2e commit 7b398c8

File tree

1 file changed

+4
-21
lines changed

1 file changed

+4
-21
lines changed

taco/cmd/taco/commands/root.go

Lines changed: 4 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,8 @@ through a simple CLI interface.`,
4444

4545
globalConfig = config
4646

47+
// Prioritize environment variables over config file
48+
// env > flags > config
4749
if !cmd.Flag("server").Changed && config.ServerUrl != "" {
4850
serverURL = config.ServerUrl
4951
}
@@ -71,6 +73,7 @@ func configPath() (string, error) {
7173
return "", err
7274
}
7375
dir := filepath.Join(home, ".config", "opentaco")
76+
7477
if err := os.MkdirAll(dir, 0o755); err != nil {
7578
return "", err
7679
}
@@ -172,7 +175,7 @@ func runSetupWizard() (*Config, error) {
172175

173176
for {
174177

175-
fmt.Print("Enter OpenTaco server url [http://localhost:8080]:")
178+
fmt.Print("Enter OpenTaco server url [http://localhost:8080]: ")
176179
serverURL, err := reader.ReadString('\n')
177180
if err != nil {
178181
return nil, err
@@ -213,26 +216,6 @@ func runSetupWizard() (*Config, error) {
213216

214217
}
215218

216-
217-
func getConfigurationValue(flagValue, configValue, envKey, defaultValue string) string {
218-
if envValue := os.Getenv(envKey); envValue != "" {
219-
return envValue
220-
}
221-
if flagValue != "" {
222-
return flagValue
223-
224-
}
225-
226-
if configValue != "" {
227-
return configValue
228-
}
229-
230-
return defaultValue
231-
232-
}
233-
234-
235-
236219
// getEnvOrDefault gets an environment variable or returns a default value
237220
func getEnvOrDefault(key, defaultValue string) string {
238221
if value := os.Getenv(key); value != "" {

0 commit comments

Comments
 (0)