Production deploy: rootDir fix, systemd unit, README, favicon
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DgBEW6qAwgn2fcQbA2f4ZQ
This commit is contained in:
co-authored by
Claude Fable 5
parent
c9d810c8e5
commit
c0e46391e5
+13
-2
@@ -1,4 +1,4 @@
|
||||
import { readFileSync } from 'node:fs';
|
||||
import { existsSync, readFileSync } from 'node:fs';
|
||||
import { fileURLToPath } from 'node:url';
|
||||
import { dirname, join } from 'node:path';
|
||||
import { z } from 'zod';
|
||||
@@ -54,7 +54,18 @@ function compileNameGlob(pattern: string): (name: string) => boolean {
|
||||
return (name) => regex.test(name);
|
||||
}
|
||||
|
||||
export const rootDir = join(dirname(fileURLToPath(import.meta.url)), '..');
|
||||
/** Project root: walk up from this module (which may live in server/ or
|
||||
* dist-server/server/) until config.json appears. */
|
||||
function findRoot(): string {
|
||||
let dir = dirname(fileURLToPath(import.meta.url));
|
||||
for (let i = 0; i < 4; i++) {
|
||||
dir = dirname(dir);
|
||||
if (existsSync(join(dir, 'config.json'))) return dir;
|
||||
}
|
||||
return process.cwd();
|
||||
}
|
||||
|
||||
export const rootDir = findRoot();
|
||||
|
||||
export function loadConfig(path = join(rootDir, 'config.json')): AppConfig {
|
||||
const raw = configSchema.parse(JSON.parse(readFileSync(path, 'utf8')));
|
||||
|
||||
Reference in New Issue
Block a user