Fix EISDIR error when config.yaml is a directory (#3)
authorStefan Gasser <redacted>
Fri, 9 Jan 2026 07:28:55 +0000 (08:28 +0100)
committerGitHub <redacted>
Fri, 9 Jan 2026 07:28:55 +0000 (08:28 +0100)
Add isFile() check before reading config to give a clear error message
when Docker creates a directory instead of mounting a missing file.

Fixes #2

src/config.ts

index 318d6aef370e01bc8758b86e774d93dbdce5e040..a5bc8fc13bd6409bafb6a619c2f928b9462e0fdd 100644 (file)
@@ -1,4 +1,4 @@
-import { existsSync, readFileSync } from "node:fs";
+import { existsSync, readFileSync, statSync } from "node:fs";
 import { parse as parseYaml } from "yaml";
 import { z } from "zod";
 
@@ -181,6 +181,11 @@ export function loadConfig(configPath?: string): Config {
 
   for (const path of paths) {
     if (existsSync(path)) {
+      if (!statSync(path).isFile()) {
+        throw new Error(
+          `'${path}' is a directory, not a file. Run: cp config.example.yaml config.yaml`,
+        );
+      }
       configFile = readFileSync(path, "utf-8");
       break;
     }
git clone https://git.99rst.org/PROJECT