Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions e2b/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,7 @@ func (c *ConnectionConfig) toEnvdConfig(sandboxID string) *runtime.Config {
RuntimePort: c.RuntimePort,
APIKey: c.APIKey,
RequestTimeout: c.RequestTimeout,
RuntimeToken: c.AccessToken,
}

// Pre-compute the full sandbox URL using the Protocol-aware logic so
Expand Down
7 changes: 4 additions & 3 deletions e2b/sandbox.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ func Create(ctx context.Context, template string, opts ...SandboxOption) (*Sandb
return nil, fmt.Errorf("failed to create sandbox: %w", err)
}

sb := newSandbox(config, api, resp.SandboxID, resp.TemplateID, resp.EnvdVersion)
sb := newSandbox(config, api, resp.SandboxID, resp.EnvdAccessToken, resp.TemplateID, resp.EnvdVersion)
return sb, nil
}

Expand All @@ -125,7 +125,7 @@ func Connect(ctx context.Context, sandboxID string, opts ...SandboxOption) (*San
return nil, fmt.Errorf("failed to connect to sandbox: %w", err)
}

sb := newSandbox(config, api, resp.GetSandboxID(), resp.GetTemplateID(), resp.GetEnvdVersion())
sb := newSandbox(config, api, resp.GetSandboxID(), resp.GetEnvdAccessToken(), resp.GetTemplateID(), resp.GetEnvdVersion())
return sb, nil
}

Expand All @@ -139,7 +139,8 @@ func applySandboxOptions(opts []SandboxOption) *sandboxOptions {
}

// newSandbox initializes a Sandbox with an envd client and management API.
func newSandbox(config *ConnectionConfig, api *SandboxApi, sandboxID, templateID, envdVersion string) *Sandbox {
func newSandbox(config *ConnectionConfig, api *SandboxApi, sandboxID, EnvdAccessToken, templateID, envdVersion string) *Sandbox {
config.AccessToken = EnvdAccessToken
client := runtime.NewWithConfig(sandboxID, config.toEnvdConfig(sandboxID))

return &Sandbox{
Expand Down
Loading