Skip to content

An open-source, faster Devin alternative

TypeScript

Default sessions-api URL to api.opencomputer.dev

Igor Zalutski9df964a0b8bb
diff --git a/cmd/oc/internal/commands/root.go b/cmd/oc/internal/commands/root.go
index 0db620a6..64e3efdc 100644
--- a/cmd/oc/internal/commands/root.go
+++ b/cmd/oc/internal/commands/root.go
@@ -31,11 +31,9 @@ var rootCmd = &cobra.Command{
c := client.New(cfg.APIURL, cfg.APIKey)
ctx := client.WithClient(cmd.Context(), c)
- // Set up sessions-api client if configured
- if cfg.SessionsAPIURL != "" {
- sc := client.NewSessionsAPI(cfg.SessionsAPIURL, cfg.APIKey)
- ctx = client.WithSessionsClient(ctx, sc)
- }
+ // Set up sessions-api client (defaults to api.opencomputer.dev)
+ sc := client.NewSessionsAPI(cfg.SessionsAPIURL, cfg.APIKey)
+ ctx = client.WithSessionsClient(ctx, sc)
cmd.SetContext(ctx)
printer = output.New(jsonOutput)
diff --git a/cmd/oc/internal/config/config.go b/cmd/oc/internal/config/config.go
index f998e30a..011233b0 100644
--- a/cmd/oc/internal/config/config.go
+++ b/cmd/oc/internal/config/config.go
@@ -9,9 +9,10 @@ import (
)
const (
- DefaultAPIURL = "https://app.opencomputer.dev"
- configDir = ".oc"
- configFile = "config.json"
+ DefaultAPIURL = "https://app.opencomputer.dev"
+ DefaultSessionsAPIURL = "https://api.opencomputer.dev"
+ configDir = ".oc"
+ configFile = "config.json"
)
// Config holds the resolved CLI configuration.
@@ -37,6 +38,9 @@ func Load(cmd *cobra.Command) Config {
if v := os.Getenv("OPENCOMPUTER_API_KEY"); v != "" {
cfg.APIKey = v
}
+ if cfg.SessionsAPIURL == "" {
+ cfg.SessionsAPIURL = DefaultSessionsAPIURL
+ }
if v := os.Getenv("SESSIONS_API_URL"); v != "" {
cfg.SessionsAPIURL = v
}