@siming-org/cli 0.5.1 → 0.5.2
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 +16 -8
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -181,6 +181,7 @@ function resolveServerConfig(args = {}, env = process.env, paths) {
|
|
|
181
181
|
const cliValues = {};
|
|
182
182
|
if (args.port !== void 0) cliValues.port = args.port;
|
|
183
183
|
if (args.mongoUri !== void 0) cliValues.mongoUri = args.mongoUri;
|
|
184
|
+
if (args.publicUrl !== void 0) cliValues.publicUrl = args.publicUrl;
|
|
184
185
|
if (Object.keys(cliValues).length > 0) {
|
|
185
186
|
layers.push({ layer: "cli", values: cliValues, detailOf: () => "CLI \u53C2\u6570" });
|
|
186
187
|
}
|
|
@@ -202,7 +203,7 @@ function resolveServerConfig(args = {}, env = process.env, paths) {
|
|
|
202
203
|
throw new ConfigValidationError("\u670D\u52A1\u914D\u7F6E\u6821\u9A8C\u5931\u8D25", issues);
|
|
203
204
|
}
|
|
204
205
|
for (const key of SIMING_CONFIG_KEYS) {
|
|
205
|
-
if (sources[key] === void 0) {
|
|
206
|
+
if (sources[key] === void 0 && result.data[key] !== void 0) {
|
|
206
207
|
sources[key] = { layer: "default", detail: "\u5185\u7F6E\u9ED8\u8BA4\u503C" };
|
|
207
208
|
}
|
|
208
209
|
}
|
|
@@ -7940,7 +7941,7 @@ function displayUrl(host, port) {
|
|
|
7940
7941
|
var MONGO_ERROR_PATTERN = /server selection|ECONNREFUSED|ENOTFOUND|EACCES|authentication/i;
|
|
7941
7942
|
function createServerCommand() {
|
|
7942
7943
|
const server = new Command17("server").description("\u7BA1\u7406 siming \u670D\u52A1\uFF08API \u4E0E Web UI \u540C\u8FDB\u7A0B\u540C\u7AEF\u53E3\uFF09");
|
|
7943
|
-
server.command("start").description("\u542F\u52A8 siming \u670D\u52A1\uFF08\u9ED8\u8BA4\u5B88\u62A4\u6A21\u5F0F\uFF0C\u65E5\u5FD7\u5199\u5165 /tmp/siming/\uFF09").option("--port <port>", "\u76D1\u542C\u7AEF\u53E3\uFF08\u9ED8\u8BA4 7777\uFF1B\u4E5F\u53EF\u7ECF PORT \u73AF\u5883\u53D8\u91CF/\u914D\u7F6E\u6587\u4EF6\u914D\u7F6E\uFF09").option("--mongo-uri <uri>", "MongoDB \u8FDE\u63A5\u4E32\uFF08\u4E5F\u53EF\u7ECF SIMING_MONGO_URI/\u914D\u7F6E\u6587\u4EF6\u914D\u7F6E\uFF09").option("--foreground", "\u524D\u53F0\u8FD0\u884C\uFF08\u8C03\u8BD5/systemd \u573A\u666F\uFF09\uFF0CCtrl+C \u4F18\u96C5\u9000\u51FA\uFF1B\u4E0D\u5199 pidfile", false).action(async (opts) => {
|
|
7944
|
+
server.command("start").description("\u542F\u52A8 siming \u670D\u52A1\uFF08\u9ED8\u8BA4\u5B88\u62A4\u6A21\u5F0F\uFF0C\u65E5\u5FD7\u5199\u5165 /tmp/siming/\uFF09").option("--port <port>", "\u76D1\u542C\u7AEF\u53E3\uFF08\u9ED8\u8BA4 7777\uFF1B\u4E5F\u53EF\u7ECF PORT \u73AF\u5883\u53D8\u91CF/\u914D\u7F6E\u6587\u4EF6\u914D\u7F6E\uFF09").option("--mongo-uri <uri>", "MongoDB \u8FDE\u63A5\u4E32\uFF08\u4E5F\u53EF\u7ECF SIMING_MONGO_URI/\u914D\u7F6E\u6587\u4EF6\u914D\u7F6E\uFF09").option("--public-url <url>", "\u5BF9\u5916\u53EF\u8FBE\u57FA\u7840\u5730\u5740\uFF08\u53CD\u4EE3\u90E8\u7F72\u65F6 whoami \u81EA\u62A5\u7528\uFF1B\u4E5F\u53EF\u7ECF SIMING_PUBLIC_URL/\u914D\u7F6E\u6587\u4EF6\u914D\u7F6E\uFF09").option("--foreground", "\u524D\u53F0\u8FD0\u884C\uFF08\u8C03\u8BD5/systemd \u573A\u666F\uFF09\uFF0CCtrl+C \u4F18\u96C5\u9000\u51FA\uFF1B\u4E0D\u5199 pidfile", false).action(async (opts) => {
|
|
7944
7945
|
process.exitCode = await startAction(opts);
|
|
7945
7946
|
});
|
|
7946
7947
|
server.command("stop").description("\u505C\u6B62 siming \u670D\u52A1\uFF08SIGTERM \u5BBD\u9650 10s \u2192 SIGKILL \u515C\u5E95\uFF09").action(async () => {
|
|
@@ -7983,7 +7984,8 @@ async function startAction(opts) {
|
|
|
7983
7984
|
try {
|
|
7984
7985
|
resolved = resolveServerConfig({
|
|
7985
7986
|
port: opts.port,
|
|
7986
|
-
mongoUri: opts.mongoUri
|
|
7987
|
+
mongoUri: opts.mongoUri,
|
|
7988
|
+
publicUrl: opts.publicUrl
|
|
7987
7989
|
});
|
|
7988
7990
|
} catch (e) {
|
|
7989
7991
|
if (e instanceof ConfigValidationError) {
|
|
@@ -8085,6 +8087,9 @@ function buildDaemonEnv(resolved) {
|
|
|
8085
8087
|
env.SIMING_HOST = resolved.config.host;
|
|
8086
8088
|
env.SIMING_LOG_LEVEL = resolved.config.logLevel;
|
|
8087
8089
|
env.SIMING_AUTH_ENABLED = String(resolved.config.auth.enabled);
|
|
8090
|
+
if (resolved.config.publicUrl !== void 0) {
|
|
8091
|
+
env.SIMING_PUBLIC_URL = resolved.config.publicUrl;
|
|
8092
|
+
}
|
|
8088
8093
|
env.SIMING_CONFIG_SOURCES_JSON = JSON.stringify(resolved.sources);
|
|
8089
8094
|
return env;
|
|
8090
8095
|
}
|
|
@@ -8231,16 +8236,19 @@ function printStartSummary(pid, resolved) {
|
|
|
8231
8236
|
}
|
|
8232
8237
|
}
|
|
8233
8238
|
function formatConfigSummary(resolved) {
|
|
8234
|
-
return SIMING_CONFIG_KEYS2.
|
|
8239
|
+
return SIMING_CONFIG_KEYS2.flatMap((key) => {
|
|
8235
8240
|
const value = resolved.config[key];
|
|
8241
|
+
if (value === void 0) return [];
|
|
8236
8242
|
const display = key === "mongoUri" ? maskMongoUri(String(value)) : String(value);
|
|
8237
|
-
return ` ${key}: ${display} \uFF08\u6765\u6E90: ${resolved.sources[key]?.detail ?? "\u5185\u7F6E\u9ED8\u8BA4\u503C"}\uFF09
|
|
8243
|
+
return [` ${key}: ${display} \uFF08\u6765\u6E90: ${resolved.sources[key]?.detail ?? "\u5185\u7F6E\u9ED8\u8BA4\u503C"}\uFF09`];
|
|
8238
8244
|
});
|
|
8239
8245
|
}
|
|
8240
8246
|
function printRunHeader(config, sources) {
|
|
8241
|
-
const summary = SIMING_CONFIG_KEYS2.
|
|
8242
|
-
const value =
|
|
8243
|
-
|
|
8247
|
+
const summary = SIMING_CONFIG_KEYS2.flatMap((key) => {
|
|
8248
|
+
const value = config[key];
|
|
8249
|
+
if (value === void 0) return [];
|
|
8250
|
+
const display = key === "mongoUri" ? maskMongoUri(String(value)) : String(value);
|
|
8251
|
+
return [`${key}=${display} (${sources[key]?.detail ?? "\u5185\u7F6E\u9ED8\u8BA4\u503C"})`];
|
|
8244
8252
|
}).join(", ");
|
|
8245
8253
|
console.log(`[${(/* @__PURE__ */ new Date()).toISOString()}] \u2500\u2500 siming server _run v${VERSION4} \u2500\u2500 pid=${process.pid}`);
|
|
8246
8254
|
console.log(`[siming] config: ${summary}`);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@siming-org/cli",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.2",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"author": "Wuchao",
|
|
6
6
|
"engines": {
|
|
@@ -27,8 +27,8 @@
|
|
|
27
27
|
"picocolors": "^1.1.1",
|
|
28
28
|
"yaml": "^2.6.0",
|
|
29
29
|
"zod": "^4.4.3",
|
|
30
|
-
"@siming-org/core": "0.5.
|
|
31
|
-
"@siming-org/server": "0.5.
|
|
30
|
+
"@siming-org/core": "0.5.2",
|
|
31
|
+
"@siming-org/server": "0.5.2"
|
|
32
32
|
},
|
|
33
33
|
"devDependencies": {
|
|
34
34
|
"tsup": "^8.3.5",
|