Skip to content

Commit 1d31013

Browse files
authored
enhance: use public gateway if none is set (#5)
Signed-off-by: Grant Linville <[email protected]>
1 parent 8ca800b commit 1d31013

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

main.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,8 @@ var (
4545
optionalScope = os.Getenv("OPTIONAL_SCOPE")
4646
)
4747

48+
const publicGatewayURL = "https://gateway-api.gptscript.ai"
49+
4850
func main() {
4951
configPath, err := xdg.ConfigFile("gptscript/config.json")
5052
if err != nil {
@@ -73,6 +75,10 @@ func main() {
7375
integrationAppID = integration
7476
}
7577

78+
if cfg.GatewayURL == "" {
79+
cfg.GatewayURL = publicGatewayURL
80+
}
81+
7682
var (
7783
authorizeURL = fmt.Sprintf("%s/oauth-apps/%s/authorize", cfg.GatewayURL, integrationAppID)
7884
refreshURL = fmt.Sprintf("%s/oauth-apps/%s/refresh", cfg.GatewayURL, integrationAppID)

0 commit comments

Comments
 (0)