@dura-run/cli 0.1.1 → 0.1.3

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.
Files changed (2) hide show
  1. package/dist/dura.js +18 -3
  2. package/package.json +1 -1
package/dist/dura.js CHANGED
@@ -2328,6 +2328,20 @@ function getApiUrl() {
2328
2328
  const config = readConfig();
2329
2329
  return config.apiUrl ?? process.env["DURA_API_URL"] ?? "https://api.dura.run";
2330
2330
  }
2331
+ function getConsoleUrl() {
2332
+ const envOverride = process.env["DURA_CONSOLE_URL"];
2333
+ if (envOverride)
2334
+ return envOverride;
2335
+ const config = readConfig();
2336
+ if (config.consoleUrl)
2337
+ return config.consoleUrl;
2338
+ const apiUrl = getApiUrl();
2339
+ const apiHostMatch = apiUrl.match(/^(https?:\/\/)api\.(.+)$/);
2340
+ if (apiHostMatch) {
2341
+ return `${apiHostMatch[1]}console.${apiHostMatch[2]}`;
2342
+ }
2343
+ return "https://console.dura.run";
2344
+ }
2331
2345
  function clearAuth() {
2332
2346
  const config = readConfig();
2333
2347
  delete config.authToken;
@@ -2423,12 +2437,13 @@ function registerLoginCommand(program2) {
2423
2437
  return;
2424
2438
  }
2425
2439
  const apiUrl = opts.apiUrl || getApiUrl();
2440
+ const consoleUrl = getConsoleUrl();
2426
2441
  let server;
2427
2442
  try {
2428
2443
  const callbackResult = await startCallbackServer();
2429
2444
  server = callbackResult.server;
2430
2445
  const { port } = callbackResult;
2431
- const loginUrl = `${apiUrl}/cli-auth?port=${port}`;
2446
+ const loginUrl = `${consoleUrl}/cli-auth?port=${port}`;
2432
2447
  output.info("Opening browser for login...");
2433
2448
  output.info(`If the browser doesn't open, visit: ${loginUrl}`);
2434
2449
  await openBrowser(loginUrl);
@@ -19151,7 +19166,7 @@ async function registerAllCommands(program2) {
19151
19166
  registerProjectsCommand2(program2);
19152
19167
  return program2;
19153
19168
  }
19154
- var CLI_VERSION = "0.1.1";
19169
+ var CLI_VERSION = "0.1.3";
19155
19170
  var init_src3 = __esm(() => {
19156
19171
  init_esm();
19157
19172
  if (import.meta.url === `file://${realpathSync(process.argv[1] ?? "").replace(/\\/g, "/")}`) {
@@ -19168,4 +19183,4 @@ export {
19168
19183
  CLI_VERSION
19169
19184
  };
19170
19185
 
19171
- //# debugId=D4CED2BDDADAF95C64756E2164756E21
19186
+ //# debugId=A4D4030A2443789464756E2164756E21
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dura-run/cli",
3
- "version": "0.1.1",
3
+ "version": "0.1.3",
4
4
  "description": "CLI for the dura.run managed automation platform",
5
5
  "license": "MIT",
6
6
  "type": "module",