@rigstate/cli 0.7.13 → 0.7.15
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.cjs +4 -42
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +4 -42
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/daemon/factory.ts +2 -3
- package/src/utils/config.ts +3 -63
package/dist/index.js
CHANGED
|
@@ -55,7 +55,6 @@ var config_exports = {};
|
|
|
55
55
|
__export(config_exports, {
|
|
56
56
|
clearConfig: () => clearConfig,
|
|
57
57
|
config: () => config,
|
|
58
|
-
discoverApiUrl: () => discoverApiUrl,
|
|
59
58
|
getApiKey: () => getApiKey,
|
|
60
59
|
getApiUrl: () => getApiUrl,
|
|
61
60
|
getProjectId: () => getProjectId,
|
|
@@ -92,43 +91,6 @@ function getApiUrl() {
|
|
|
92
91
|
}
|
|
93
92
|
return "https://app.rigstate.com";
|
|
94
93
|
}
|
|
95
|
-
async function discoverApiUrl() {
|
|
96
|
-
const configuredUrl = getApiUrl();
|
|
97
|
-
const { default: axios22 } = await import("axios");
|
|
98
|
-
const { default: chalk34 } = await import("chalk");
|
|
99
|
-
console.log(chalk34.gray(`\u{1F50D} Discovering local Rigstate API URL... Configured: ${configuredUrl}`));
|
|
100
|
-
if (!configuredUrl.includes("localhost") && !configuredUrl.includes("127.0.0.1")) {
|
|
101
|
-
console.log(chalk34.gray(` Configured URL is not localhost, trusting: ${configuredUrl}`));
|
|
102
|
-
return configuredUrl;
|
|
103
|
-
}
|
|
104
|
-
const ports = [3e3, 3001, 3002, 3003, 3004, 3005, 3006, 3007, 3008, 3009, 3010];
|
|
105
|
-
for (const port of ports) {
|
|
106
|
-
const url = `http://localhost:${port}`;
|
|
107
|
-
try {
|
|
108
|
-
console.log(chalk34.gray(` Attempting to connect to ${url}/api/v1/system/health...`));
|
|
109
|
-
await axios22.get(`${url}/api/v1/system/health`, { timeout: 800 });
|
|
110
|
-
console.log(chalk34.green(` \u2705 Found Rigstate API at ${url}`));
|
|
111
|
-
if (url !== configuredUrl) {
|
|
112
|
-
console.log(chalk34.gray(` Updating stored API URL from ${configuredUrl} to ${url}`));
|
|
113
|
-
setApiUrl(url);
|
|
114
|
-
}
|
|
115
|
-
return url;
|
|
116
|
-
} catch (e) {
|
|
117
|
-
if (axios22.isAxiosError(e) && e.response && e.response.status === 404) {
|
|
118
|
-
console.log(chalk34.yellow(` \u26A0\uFE0F ${url} responded with 404, but might still be a Rigstate server. Skipping for now.`));
|
|
119
|
-
} else if (axios22.isAxiosError(e) && e.code === "ECONNABORTED") {
|
|
120
|
-
console.log(chalk34.gray(` Connection to ${url} timed out.`));
|
|
121
|
-
} else if (axios22.isAxiosError(e) && e.code === "ECONNREFUSED") {
|
|
122
|
-
console.log(chalk34.gray(` Connection to ${url} refused.`));
|
|
123
|
-
} else {
|
|
124
|
-
console.log(chalk34.gray(` Failed to connect to ${url}: ${e.message}`));
|
|
125
|
-
}
|
|
126
|
-
continue;
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
console.log(chalk34.yellow(` \u274C No local Rigstate API found on scanned ports. Falling back to Rigstate Cloud.`));
|
|
130
|
-
return "https://app.rigstate.com";
|
|
131
|
-
}
|
|
132
94
|
function setApiUrl(url) {
|
|
133
95
|
config.set("apiUrl", url);
|
|
134
96
|
}
|
|
@@ -143,7 +105,7 @@ var init_config = __esm({
|
|
|
143
105
|
config = new Conf({
|
|
144
106
|
projectName: "rigstate-cli",
|
|
145
107
|
defaults: {
|
|
146
|
-
apiUrl: "
|
|
108
|
+
apiUrl: "https://app.rigstate.com"
|
|
147
109
|
}
|
|
148
110
|
});
|
|
149
111
|
}
|
|
@@ -1881,9 +1843,9 @@ function createLinkCommand() {
|
|
|
1881
1843
|
console.log("");
|
|
1882
1844
|
console.log(chalk6.bold("\u{1F916} Rigstate Automation Detected"));
|
|
1883
1845
|
console.log("");
|
|
1884
|
-
const { getApiKey: getApiKey2, getApiUrl:
|
|
1846
|
+
const { getApiKey: getApiKey2, getApiUrl: getApiUrl2 } = await Promise.resolve().then(() => (init_config(), config_exports));
|
|
1885
1847
|
const apiKey = getApiKey2();
|
|
1886
|
-
const apiUrl =
|
|
1848
|
+
const apiUrl = getApiUrl2();
|
|
1887
1849
|
if (apiKey) {
|
|
1888
1850
|
console.log(chalk6.blue("\u{1F510} Checking Vault for secrets..."));
|
|
1889
1851
|
const { syncEnv: syncEnv2 } = await Promise.resolve().then(() => (init_env(), env_exports));
|
|
@@ -3906,7 +3868,7 @@ var GuardianDaemon = class extends EventEmitter3 {
|
|
|
3906
3868
|
// src/daemon/factory.ts
|
|
3907
3869
|
init_config();
|
|
3908
3870
|
async function createDaemon(options) {
|
|
3909
|
-
const apiUrl =
|
|
3871
|
+
const apiUrl = getApiUrl();
|
|
3910
3872
|
let projectId = options.project;
|
|
3911
3873
|
if (!projectId) {
|
|
3912
3874
|
const manifest = await loadManifest();
|