From cfe7d7d4c4f9bac7262f495b770da8ad64c5e6c2 Mon Sep 17 00:00:00 2001 From: Mark Powers Date: Sun, 14 Jul 2024 15:17:48 -0500 Subject: Add docker configuration --- src/index.js | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'src/index.js') diff --git a/src/index.js b/src/index.js index c731166..660cdc7 100644 --- a/src/index.js +++ b/src/index.js @@ -4,9 +4,8 @@ const path = require('path'); const jwt = require('jsonwebtoken'); // Load the config and configurable parameteres -const config = JSON.parse(fs.readFileSync(path.join(__dirname, 'config.json'))); -const dbCreds = config.database -const secret = config.jwt_secret; +const { env } = require('node:process'); +const secret = env.JWT_SECRET // An object to help sign and verify jwt cookies const jwtFunctions = { @@ -19,7 +18,7 @@ const jwtFunctions = { } // Create the database object -const database = new Sequelize(dbCreds.database, undefined, undefined, { +const database = new Sequelize(env.DATABASE, undefined, undefined, { logging(str) { console.debug(`DB:${str}`); }, @@ -27,7 +26,7 @@ const database = new Sequelize(dbCreds.database, undefined, undefined, { charset: 'utf8mb4', multipleStatements: true, }, - storage: './database.sqlite', + storage: '/data/database.sqlite', dialect: 'sqlite', pool: { max: 5, @@ -87,4 +86,4 @@ server.load("./paperflight/server", models, jwtFunctions, database) server.load("./trivia/server", models, jwtFunctions, database) // Start the server -server.listen(config.port); +server.listen(8080); -- cgit v1.2.3