Polish project documentation and runtime config

This commit is contained in:
2026-06-09 10:22:59 +08:00
parent 5f061295d8
commit 0594fc9f8c
43 changed files with 1001 additions and 97 deletions

View File

@@ -1,6 +1,7 @@
import http from "node:http";
import { spawn } from "node:child_process";
import { readFileSync } from "node:fs";
import path from "node:path";
function readEnvKey(path, key) {
const txt = readFileSync(path, "utf8");
@@ -62,8 +63,10 @@ async function wait(ms) {
}
async function main() {
const key = readEnvKey("/Users/xuexue/new2/.env", "AMAP_JS_KEY");
const security = readEnvKey("/Users/xuexue/new2/.env", "AMAP_SECURITY_JSCODE");
const root = path.resolve(new URL("..", import.meta.url).pathname, "..");
const envPath = process.env.TRAVEL_KG_ENV_PATH || path.join(root, ".env");
const key = readEnvKey(envPath, "AMAP_JS_KEY");
const security = readEnvKey(envPath, "AMAP_SECURITY_JSCODE");
if (!key || !security) throw new Error("missing AMap JS key/security");
const chrome = spawn(