@glassly/cli 2.0.0-dev.1 → 2.0.0-dev.2
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 +7 -0
- package/package.json +1 -1
- package/src/api.ts +1 -1
- package/src/config.ts +14 -4
package/README.md
CHANGED
|
@@ -55,3 +55,10 @@ glassly media add <packageName> screenshot ./store/screenshots/01.png
|
|
|
55
55
|
```
|
|
56
56
|
|
|
57
57
|
Run `glassly <command> --help` for the full option set.
|
|
58
|
+
|
|
59
|
+
## Backend selection
|
|
60
|
+
|
|
61
|
+
The CLI talks to the production Glassly backend and Developer Console by
|
|
62
|
+
default; nothing needs configuring. To point it at another deployment, set
|
|
63
|
+
`CLOUD_CORE_URL`, `CLOUD_CONSOLE_URL`, and that backend's public WorkOS
|
|
64
|
+
AuthKit client id in `WORKOS_CLIENT_ID`. Logins are stored per backend URL.
|
package/package.json
CHANGED
package/src/api.ts
CHANGED
|
@@ -454,7 +454,7 @@ async function coreRequest<T>(
|
|
|
454
454
|
function assertWorkosClientId(config: CliConfig): void {
|
|
455
455
|
if (!config.workosClientId) {
|
|
456
456
|
throw new Error(
|
|
457
|
-
"WORKOS_CLIENT_ID is
|
|
457
|
+
"WORKOS_CLIENT_ID is set but empty. Unset it to use the production login, or set it to the AuthKit client id of the backend in CLOUD_CORE_URL.",
|
|
458
458
|
);
|
|
459
459
|
}
|
|
460
460
|
}
|
package/src/config.ts
CHANGED
|
@@ -5,12 +5,22 @@ export interface CliConfig {
|
|
|
5
5
|
workosApiBaseUrl: string;
|
|
6
6
|
}
|
|
7
7
|
|
|
8
|
+
// Production is the default so a developer can run `glassly login` with no
|
|
9
|
+
// setup. The WorkOS client id is the public AuthKit identifier of the
|
|
10
|
+
// production environment, not a secret. Internal use against dev or staging
|
|
11
|
+
// overrides all three through the environment (see the glassly:* scripts in
|
|
12
|
+
// cloud-v2/package.json, which take them from Doppler).
|
|
13
|
+
const PRODUCTION = {
|
|
14
|
+
coreUrl: "https://core.glassly.ai",
|
|
15
|
+
consoleUrl: "https://console.glassly.ai",
|
|
16
|
+
workosClientId: "client_01KY5EVQT1PE8V11ZKZ1Q56XTK",
|
|
17
|
+
};
|
|
18
|
+
|
|
8
19
|
export function getConfig(): CliConfig {
|
|
9
|
-
const workosClientId = process.env.WORKOS_CLIENT_ID || "";
|
|
10
20
|
return {
|
|
11
|
-
coreUrl: normalizeUrl(process.env.CLOUD_CORE_URL ||
|
|
12
|
-
consoleUrl: normalizeUrl(process.env.CLOUD_CONSOLE_URL ||
|
|
13
|
-
workosClientId,
|
|
21
|
+
coreUrl: normalizeUrl(process.env.CLOUD_CORE_URL || PRODUCTION.coreUrl),
|
|
22
|
+
consoleUrl: normalizeUrl(process.env.CLOUD_CONSOLE_URL || PRODUCTION.consoleUrl),
|
|
23
|
+
workosClientId: process.env.WORKOS_CLIENT_ID || PRODUCTION.workosClientId,
|
|
14
24
|
workosApiBaseUrl: normalizeUrl(process.env.WORKOS_API_BASE_URL || "https://api.workos.com"),
|
|
15
25
|
};
|
|
16
26
|
}
|