connectbase-client 0.10.9 → 0.10.11
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/cli.js +29 -9
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -122,6 +122,7 @@ function loadConfig() {
|
|
|
122
122
|
try {
|
|
123
123
|
const rcContent = JSON.parse(fs.readFileSync(rcPath, "utf-8"));
|
|
124
124
|
if (rcContent.apiKey) config.apiKey = rcContent.apiKey;
|
|
125
|
+
if (rcContent.secretKey) config.secretKey = rcContent.secretKey;
|
|
125
126
|
if (rcContent.storageId) config.storageId = rcContent.storageId;
|
|
126
127
|
if (rcContent.baseUrl) config.baseUrl = rcContent.baseUrl;
|
|
127
128
|
if (rcContent.deployDir) config.deployDir = rcContent.deployDir;
|
|
@@ -638,6 +639,9 @@ ${colors.blue}?${colors.reset} \uC120\uD0DD (\uBC88\uD638): `);
|
|
|
638
639
|
storageId,
|
|
639
640
|
deployDir
|
|
640
641
|
};
|
|
642
|
+
if (secretKey) {
|
|
643
|
+
config.secretKey = secretKey;
|
|
644
|
+
}
|
|
641
645
|
fs.writeFileSync(rcPath, JSON.stringify(config, null, 2) + "\n");
|
|
642
646
|
success(".connectbaserc \uC0DD\uC131 \uC644\uB8CC");
|
|
643
647
|
addToGitignore(".connectbaserc");
|
|
@@ -1111,15 +1115,31 @@ ${colors.blue}?${colors.reset} \uC571 \uC120\uD0DD (\uBC88\uD638): `);
|
|
|
1111
1115
|
return createData.app_id;
|
|
1112
1116
|
}
|
|
1113
1117
|
async function startTunnel(port, config, tunnelOpts) {
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
info("Secret Key\
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1118
|
+
const tunnelKey = config.secretKey || (config.apiKey?.startsWith("cb_sk_") ? config.apiKey : "");
|
|
1119
|
+
if (!tunnelKey) {
|
|
1120
|
+
info("Secret Key\uAC00 \uC5C6\uC2B5\uB2C8\uB2E4. \uBE0C\uB77C\uC6B0\uC800 \uB85C\uADF8\uC778\uC73C\uB85C \uBC1C\uAE09\uD569\uB2C8\uB2E4...");
|
|
1121
|
+
try {
|
|
1122
|
+
const sk = await browserAuthFlow();
|
|
1123
|
+
const rcPath = path.join(process.cwd(), ".connectbaserc");
|
|
1124
|
+
let rcData = {};
|
|
1125
|
+
if (fs.existsSync(rcPath)) {
|
|
1126
|
+
try {
|
|
1127
|
+
rcData = JSON.parse(fs.readFileSync(rcPath, "utf-8"));
|
|
1128
|
+
} catch {
|
|
1129
|
+
}
|
|
1130
|
+
}
|
|
1131
|
+
rcData.secretKey = sk;
|
|
1132
|
+
fs.writeFileSync(rcPath, JSON.stringify(rcData, null, 2) + "\n");
|
|
1133
|
+
addToGitignore(".connectbaserc");
|
|
1134
|
+
success("Secret Key \uBC1C\uAE09 \uBC0F \uC800\uC7A5 \uC644\uB8CC");
|
|
1135
|
+
config.apiKey = sk;
|
|
1136
|
+
} catch (err) {
|
|
1137
|
+
error(`\uC778\uC99D \uC2E4\uD328: ${err instanceof Error ? err.message : err}`);
|
|
1138
|
+
info("-k \uC635\uC158\uC73C\uB85C Secret Key\uB97C \uC9C1\uC811 \uC804\uB2EC\uD560 \uC218\uB3C4 \uC788\uC2B5\uB2C8\uB2E4");
|
|
1139
|
+
process.exit(1);
|
|
1140
|
+
}
|
|
1141
|
+
} else {
|
|
1142
|
+
config.apiKey = tunnelKey;
|
|
1123
1143
|
}
|
|
1124
1144
|
const appId = await resolveAppForTunnel(config.apiKey, config.baseUrl, tunnelOpts?.appId);
|
|
1125
1145
|
const tunnelServerUrl = getTunnelServerUrl(config.baseUrl);
|