diff --git a/src/api/index.ts b/src/api/index.ts index a8294c1..312b52d 100644 --- a/src/api/index.ts +++ b/src/api/index.ts @@ -1,5 +1,6 @@ /* 3rd party imports */ import path from 'path'; +import fs from 'fs'; import SQLite3 from 'better-sqlite3'; import express from 'express'; import { ApolloServer } from 'apollo-server-express'; @@ -39,6 +40,7 @@ class Api { this.config = config; try { + if (!fs.existsSync(this.config.dataDirectory)) fs.mkdirSync(this.config.dataDirectory, '0700'); this.db = new SQLite3(path.join(this.config.dataDirectory, 'go-music.db')); } catch(err) { Constants.FATAL_ERROR(`Error creating SQLite3 DB: ${err}`); diff --git a/src/config.ts b/src/config.ts index 8f1c7dd..e4f89ec 100644 --- a/src/config.ts +++ b/src/config.ts @@ -51,7 +51,7 @@ export const getOrSetConfig = async function(configPath: string, config: ConfigS }; const dirCreate = async function(): Promise { const configDir = path.dirname(configPath); - return fs.promises.mkdir(configDir, '0755') + return fs.promises.mkdir(configDir, '0750') .catch(() => { throw `Could not create ${configDir}` }); }; const openFile = async function(): Promise {