Skip to content

Commit f3bd1bc

Browse files
committed
enable reading server uri from env var
1 parent 1fe7598 commit f3bd1bc

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

internal/config/env.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,12 @@ func (c *Config) addEnvVars() error {
1313
}
1414
c.Cloud.AuthToken = authToken
1515

16+
serverUri := os.Getenv("SQLC_SERVER_URI")
17+
if serverUri != "" && len(c.Servers) != 1 {
18+
return fmt.Errorf("$SQLC_SERVER_URI may only be used when there is exactly one server in config file")
19+
} else if serverUri != "" {
20+
c.Servers[0].URI = serverUri
21+
}
22+
1623
return nil
1724
}

0 commit comments

Comments
 (0)