connectbase-client 0.10.12 → 0.10.13
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 +28 -5
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -1147,16 +1147,16 @@ async function startTunnel(port, config, tunnelOpts) {
|
|
|
1147
1147
|
info("Secret Key\uAC00 \uC5C6\uC2B5\uB2C8\uB2E4. \uBE0C\uB77C\uC6B0\uC800 \uB85C\uADF8\uC778\uC73C\uB85C \uBC1C\uAE09\uD569\uB2C8\uB2E4...");
|
|
1148
1148
|
try {
|
|
1149
1149
|
const sk = await browserAuthFlow();
|
|
1150
|
-
const
|
|
1150
|
+
const rcPath2 = path.join(process.cwd(), ".connectbaserc");
|
|
1151
1151
|
let rcData = {};
|
|
1152
|
-
if (fs.existsSync(
|
|
1152
|
+
if (fs.existsSync(rcPath2)) {
|
|
1153
1153
|
try {
|
|
1154
|
-
rcData = JSON.parse(fs.readFileSync(
|
|
1154
|
+
rcData = JSON.parse(fs.readFileSync(rcPath2, "utf-8"));
|
|
1155
1155
|
} catch {
|
|
1156
1156
|
}
|
|
1157
1157
|
}
|
|
1158
1158
|
rcData.secretKey = sk;
|
|
1159
|
-
fs.writeFileSync(
|
|
1159
|
+
fs.writeFileSync(rcPath2, JSON.stringify(rcData, null, 2) + "\n");
|
|
1160
1160
|
addToGitignore(".connectbaserc");
|
|
1161
1161
|
success("Secret Key \uBC1C\uAE09 \uBC0F \uC800\uC7A5 \uC644\uB8CC");
|
|
1162
1162
|
config.apiKey = sk;
|
|
@@ -1168,7 +1168,30 @@ async function startTunnel(port, config, tunnelOpts) {
|
|
|
1168
1168
|
} else {
|
|
1169
1169
|
config.apiKey = tunnelKey;
|
|
1170
1170
|
}
|
|
1171
|
-
const
|
|
1171
|
+
const rcPath = path.join(process.cwd(), ".connectbaserc");
|
|
1172
|
+
let savedAppId = tunnelOpts?.appId || "";
|
|
1173
|
+
if (!savedAppId) {
|
|
1174
|
+
try {
|
|
1175
|
+
const rc = JSON.parse(fs.readFileSync(rcPath, "utf-8"));
|
|
1176
|
+
if (rc.tunnelAppId) savedAppId = rc.tunnelAppId;
|
|
1177
|
+
} catch {
|
|
1178
|
+
}
|
|
1179
|
+
}
|
|
1180
|
+
const appId = await resolveAppForTunnel(config.apiKey, config.baseUrl, savedAppId);
|
|
1181
|
+
try {
|
|
1182
|
+
let rcData = {};
|
|
1183
|
+
if (fs.existsSync(rcPath)) {
|
|
1184
|
+
try {
|
|
1185
|
+
rcData = JSON.parse(fs.readFileSync(rcPath, "utf-8"));
|
|
1186
|
+
} catch {
|
|
1187
|
+
}
|
|
1188
|
+
}
|
|
1189
|
+
if (rcData.tunnelAppId !== appId) {
|
|
1190
|
+
rcData.tunnelAppId = appId;
|
|
1191
|
+
fs.writeFileSync(rcPath, JSON.stringify(rcData, null, 2) + "\n");
|
|
1192
|
+
}
|
|
1193
|
+
} catch {
|
|
1194
|
+
}
|
|
1172
1195
|
const tunnelServerUrl = getTunnelServerUrl(config.baseUrl);
|
|
1173
1196
|
const parsedUrl = new URL(tunnelServerUrl);
|
|
1174
1197
|
const isHttps = parsedUrl.protocol === "https:";
|