@opencomputer/sdk 0.4.0 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/dist/sandbox.js +4 -4
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -31,8 +31,8 @@ await sandbox.kill();
|
|
|
31
31
|
|
|
32
32
|
| Option | Env Variable | Default |
|
|
33
33
|
|-----------|------------------------|--------------------------|
|
|
34
|
-
| `apiUrl` | `
|
|
35
|
-
| `apiKey` | `
|
|
34
|
+
| `apiUrl` | `OPENCOMPUTER_API_URL` | `https://app.opencomputer.dev` |
|
|
35
|
+
| `apiKey` | `OPENCOMPUTER_API_KEY` | (none) |
|
|
36
36
|
|
|
37
37
|
## License
|
|
38
38
|
|
package/dist/sandbox.js
CHANGED
|
@@ -36,8 +36,8 @@ export class Sandbox {
|
|
|
36
36
|
return this._status;
|
|
37
37
|
}
|
|
38
38
|
static async create(opts = {}) {
|
|
39
|
-
const apiUrl = resolveApiUrl(opts.apiUrl ?? process.env.
|
|
40
|
-
const apiKey = opts.apiKey ?? process.env.
|
|
39
|
+
const apiUrl = resolveApiUrl(opts.apiUrl ?? process.env.OPENCOMPUTER_API_URL ?? "https://app.opencomputer.dev");
|
|
40
|
+
const apiKey = opts.apiKey ?? process.env.OPENCOMPUTER_API_KEY ?? "";
|
|
41
41
|
const body = {
|
|
42
42
|
templateID: opts.template ?? "base",
|
|
43
43
|
timeout: opts.timeout ?? 300,
|
|
@@ -62,8 +62,8 @@ export class Sandbox {
|
|
|
62
62
|
return new Sandbox(data, apiUrl, apiKey);
|
|
63
63
|
}
|
|
64
64
|
static async connect(sandboxId, opts = {}) {
|
|
65
|
-
const apiUrl = resolveApiUrl(opts.apiUrl ?? process.env.
|
|
66
|
-
const apiKey = opts.apiKey ?? process.env.
|
|
65
|
+
const apiUrl = resolveApiUrl(opts.apiUrl ?? process.env.OPENCOMPUTER_API_URL ?? "https://app.opencomputer.dev");
|
|
66
|
+
const apiKey = opts.apiKey ?? process.env.OPENCOMPUTER_API_KEY ?? "";
|
|
67
67
|
const resp = await fetch(`${apiUrl}/sandboxes/${sandboxId}`, {
|
|
68
68
|
headers: apiKey ? { "X-API-Key": apiKey } : {},
|
|
69
69
|
});
|