sagacloud 0.3.3 → 0.3.4
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/index.js +15 -9
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -71,6 +71,7 @@ function getAuthFilePath() {
|
|
|
71
71
|
function readAuthProfile() {
|
|
72
72
|
const envToken = (process.env.SAGACLOUD_TOKEN || "").trim();
|
|
73
73
|
const envUrl = (process.env.SAGACLOUD_API_URL || "").trim().replace(/\/+$/, "");
|
|
74
|
+
const envPanelUrl = (process.env.SAGACLOUD_PANEL_URL || "").trim().replace(/\/+$/, "");
|
|
74
75
|
let disk = null;
|
|
75
76
|
const fp = getAuthFilePath();
|
|
76
77
|
if (fs.existsSync(fp)) {
|
|
@@ -79,7 +80,8 @@ function readAuthProfile() {
|
|
|
79
80
|
if (parsed?.token) {
|
|
80
81
|
disk = {
|
|
81
82
|
...parsed,
|
|
82
|
-
apiUrl: (parsed.apiUrl || DEFAULT_API_BASE_URL).replace(/\/+$/, "")
|
|
83
|
+
apiUrl: (parsed.apiUrl || DEFAULT_API_BASE_URL).replace(/\/+$/, ""),
|
|
84
|
+
panelUrl: (parsed.panelUrl || DEFAULT_PANEL_BASE_URL).replace(/\/+$/, "")
|
|
83
85
|
};
|
|
84
86
|
}
|
|
85
87
|
} catch {
|
|
@@ -90,14 +92,18 @@ function readAuthProfile() {
|
|
|
90
92
|
return {
|
|
91
93
|
token: envToken,
|
|
92
94
|
apiUrl: envUrl || disk?.apiUrl || DEFAULT_API_BASE_URL,
|
|
93
|
-
panelUrl: disk?.panelUrl || DEFAULT_PANEL_BASE_URL,
|
|
95
|
+
panelUrl: envPanelUrl || disk?.panelUrl || DEFAULT_PANEL_BASE_URL,
|
|
94
96
|
user: disk?.user,
|
|
95
97
|
tenant: disk?.tenant,
|
|
96
98
|
tenantName: disk?.tenantName
|
|
97
99
|
};
|
|
98
100
|
}
|
|
99
|
-
if (disk && envUrl) {
|
|
100
|
-
return {
|
|
101
|
+
if (disk && (envUrl || envPanelUrl)) {
|
|
102
|
+
return {
|
|
103
|
+
...disk,
|
|
104
|
+
apiUrl: envUrl || disk.apiUrl,
|
|
105
|
+
panelUrl: envPanelUrl || disk.panelUrl
|
|
106
|
+
};
|
|
101
107
|
}
|
|
102
108
|
return disk;
|
|
103
109
|
}
|
|
@@ -513,11 +519,11 @@ function renderCallbackHtml(opts) {
|
|
|
513
519
|
</html>`;
|
|
514
520
|
}
|
|
515
521
|
function registerAuthCommands(program2) {
|
|
516
|
-
program2.command("login").description("Authenticate CLI via browser approval, manual code paste, or --token").option("--token <token>", "Store an existing sc_live_... API token directly").option("--manual", "Prompt to paste an authorization code or token instead of waiting for 127.0.0.1 callback", false).option("--no-browser", "Do not launch a local browser automatically").option("--url <apiUrl>", "SagaCloud API base URL
|
|
517
|
-
const apiUrl = (opts.url || DEFAULT_API_BASE_URL).replace(/\/+$/, "");
|
|
518
|
-
const panelBase = (opts.panelUrl || DEFAULT_PANEL_BASE_URL).replace(/\/+$/, "");
|
|
522
|
+
program2.command("login").description("Authenticate CLI via browser approval, manual code paste, or --token").option("--token <token>", "Store an existing sc_live_... API token directly").option("--manual", "Prompt to paste an authorization code or token instead of waiting for 127.0.0.1 callback", false).option("--no-browser", "Do not launch a local browser automatically").option("--url <apiUrl>", "SagaCloud API base URL (or set SAGACLOUD_API_URL)").option("--panel-url <panelUrl>", "SagaCloud Dashboard URL for browser login (or set SAGACLOUD_PANEL_URL)").action(async (opts) => {
|
|
523
|
+
const apiUrl = (opts.url || process.env.SAGACLOUD_API_URL || DEFAULT_API_BASE_URL).trim().replace(/\/+$/, "");
|
|
524
|
+
const panelBase = (opts.panelUrl || process.env.SAGACLOUD_PANEL_URL || DEFAULT_PANEL_BASE_URL).trim().replace(/\/+$/, "");
|
|
519
525
|
if (opts.token) {
|
|
520
|
-
await authenticateWithToken(opts.token, apiUrl,
|
|
526
|
+
await authenticateWithToken(opts.token, apiUrl, panelBase);
|
|
521
527
|
return;
|
|
522
528
|
}
|
|
523
529
|
if (opts.manual) {
|
|
@@ -2097,7 +2103,7 @@ function registerSkillCommands(program2) {
|
|
|
2097
2103
|
|
|
2098
2104
|
// src/index.ts
|
|
2099
2105
|
var program = new Command();
|
|
2100
|
-
program.name("sagacloud").description("SagaCloud CLI \u2014 deploy Static, SPA, Express & Node.js apps cleanly").version("0.3.
|
|
2106
|
+
program.name("sagacloud").description("SagaCloud CLI \u2014 deploy Static, SPA, Express & Node.js apps cleanly").version("0.3.4");
|
|
2101
2107
|
registerAuthCommands(program);
|
|
2102
2108
|
registerProjectCommands(program);
|
|
2103
2109
|
registerDeployCommands(program);
|