runcloud 0.1.99 → 0.1.100
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/dist/commands/create.js +2 -2
- package/dist/commands/environment.js +3 -3
- package/dist/config.js +3 -0
- package/dist/version.js +1 -1
- package/package.json +1 -1
package/dist/commands/create.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { existsSync, mkdirSync, writeFileSync } from 'node:fs';
|
|
2
2
|
import { basename, join, resolve } from 'node:path';
|
|
3
3
|
import { ApiClient, ApiError, friendlyApiError } from '../api.js';
|
|
4
|
-
import { requireCredentials, writeEnvironmentSelection, writeProjectLink } from '../config.js';
|
|
4
|
+
import { controlPlaneUrl, requireCredentials, writeEnvironmentSelection, writeProjectLink, } from '../config.js';
|
|
5
5
|
import { runEnvironmentDeploy } from './deploy.js';
|
|
6
6
|
const POLL_INTERVAL_MS = 2_000;
|
|
7
7
|
const POLL_TIMEOUT_MS = 20 * 60 * 1_000;
|
|
@@ -121,7 +121,7 @@ export function registerCreate(program) {
|
|
|
121
121
|
throw new Error('This directory is already linked to a project. Use a fresh directory for `newly create`.');
|
|
122
122
|
}
|
|
123
123
|
const creds = requireCredentials();
|
|
124
|
-
await runCreate(new ApiClient(creds
|
|
124
|
+
await runCreate(new ApiClient(controlPlaneUrl(creds), creds.token), process.cwd(), {
|
|
125
125
|
name,
|
|
126
126
|
deploy: opts.deploy,
|
|
127
127
|
});
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { createInterface } from 'node:readline/promises';
|
|
2
2
|
import { ApiClient, friendlyApiError } from '../api.js';
|
|
3
3
|
import { runEnvironmentDatabaseShell } from '../shellSession.js';
|
|
4
|
-
import { clearEnvironmentSelection, readEnvironmentSelection, requireCredentials, requireEnvironmentSelection, resolveProject, writeEnvironmentSelection, } from '../config.js';
|
|
4
|
+
import { clearEnvironmentSelection, readEnvironmentSelection, controlPlaneUrl, requireCredentials, requireEnvironmentSelection, resolveProject, writeEnvironmentSelection, } from '../config.js';
|
|
5
5
|
const POLL_INTERVAL_MS = 2_000;
|
|
6
6
|
const POLL_TIMEOUT_MS = 10 * 60 * 1_000;
|
|
7
7
|
function client() {
|
|
8
8
|
const credentials = requireCredentials();
|
|
9
|
-
return new ApiClient(credentials
|
|
9
|
+
return new ApiClient(controlPlaneUrl(credentials), credentials.token);
|
|
10
10
|
}
|
|
11
11
|
async function projectEnvironments(api, projectId) {
|
|
12
12
|
const response = await api.get(`/projects/${encodeURIComponent(projectId)}/environments`);
|
|
@@ -248,7 +248,7 @@ export function registerEnvironment(program) {
|
|
|
248
248
|
const projectId = resolveProject(process.cwd(), opts.project);
|
|
249
249
|
const selected = requireEnvironmentSelection(process.cwd(), projectId);
|
|
250
250
|
const credentials = requireCredentials();
|
|
251
|
-
const environment = await new ApiClient(credentials
|
|
251
|
+
const environment = await new ApiClient(controlPlaneUrl(credentials), credentials.token).get(`/environments/${encodeURIComponent(selected.id)}`);
|
|
252
252
|
const resource = resolveNamedResource(environment.databases, value, 'database');
|
|
253
253
|
if (resource.status !== 'ready')
|
|
254
254
|
throw new Error(`Database is not ready (${resource.status}).`);
|
package/dist/config.js
CHANGED
|
@@ -33,6 +33,9 @@ export function loginCommandName() {
|
|
|
33
33
|
export function normalizeApiUrl(url) {
|
|
34
34
|
return url.replace(/\/+$/, '');
|
|
35
35
|
}
|
|
36
|
+
export function controlPlaneUrl(creds) {
|
|
37
|
+
return normalizeApiUrl(creds.authApiUrl ?? creds.apiUrl);
|
|
38
|
+
}
|
|
36
39
|
export function saveCredentials(creds) {
|
|
37
40
|
mkdirSync(credentialsHome(), { recursive: true, mode: 0o700 });
|
|
38
41
|
const normalized = { ...creds, apiUrl: normalizeApiUrl(creds.apiUrl) };
|
package/dist/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const CLI_VERSION = '0.1.
|
|
1
|
+
export const CLI_VERSION = '0.1.100';
|