Ensure recursive creation of ssh-keys directory

Updated the initialization logic to use the 'recursive' option when creating the data/ssh-keys directory, ensuring parent directories are created if they do not exist.
This commit is contained in:
CanbiZ
2025-11-28 13:23:31 +01:00
parent e0baa79d6b
commit 69c10b05ac
2 changed files with 4 additions and 4 deletions

View File

@@ -9,10 +9,10 @@ class DatabaseServicePrisma {
} }
init() { init() {
// Ensure data/ssh-keys directory exists // Ensure data/ssh-keys directory exists (recursive to create parent dirs)
const sshKeysDir = join(process.cwd(), 'data', 'ssh-keys'); const sshKeysDir = join(process.cwd(), 'data', 'ssh-keys');
if (!existsSync(sshKeysDir)) { if (!existsSync(sshKeysDir)) {
mkdirSync(sshKeysDir, { mode: 0o700 }); mkdirSync(sshKeysDir, { recursive: true, mode: 0o700 });
} }
} }

View File

@@ -11,10 +11,10 @@ class DatabaseServicePrisma {
} }
init() { init() {
// Ensure data/ssh-keys directory exists // Ensure data/ssh-keys directory exists (recursive to create parent dirs)
const sshKeysDir = join(process.cwd(), 'data', 'ssh-keys'); const sshKeysDir = join(process.cwd(), 'data', 'ssh-keys');
if (!existsSync(sshKeysDir)) { if (!existsSync(sshKeysDir)) {
mkdirSync(sshKeysDir, { mode: 0o700 }); mkdirSync(sshKeysDir, { recursive: true, mode: 0o700 });
} }
} }