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 +++++------ src/quadrowple/server.js | 2 +- src/quiz-bunny/server.js | 2 +- src/server.js | 2 +- src/trivia/server.js | 2 +- 5 files changed, 9 insertions(+), 10 deletions(-) (limited to 'src') 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); diff --git a/src/quadrowple/server.js b/src/quadrowple/server.js index 3474c6b..fc54d4b 100644 --- a/src/quadrowple/server.js +++ b/src/quadrowple/server.js @@ -1,4 +1,4 @@ -const uuidv4 = require('uuid/v4'); +const uuidv4 = require('uuid')["v4"]; function setUpRoutes(server, models, jwtFunctions, database) { diff --git a/src/quiz-bunny/server.js b/src/quiz-bunny/server.js index 0725fdc..347223e 100644 --- a/src/quiz-bunny/server.js +++ b/src/quiz-bunny/server.js @@ -1,4 +1,4 @@ -const uuidv4 = require('uuid/v4'); +const uuidv4 = require('uuid')["v4"]; const words = require('./words').words; const prompts = require('./prompts').prompts; diff --git a/src/server.js b/src/server.js index c159666..91c6d05 100644 --- a/src/server.js +++ b/src/server.js @@ -1,7 +1,7 @@ const express = require('express'); const bodyParser = require('body-parser'); const cookieParser = require('cookie-parser'); -const uuidv4 = require('uuid/v4'); +const uuidv4 = require('uuid')["v4"]; const Op = require('sequelize').Op; const server = express(); diff --git a/src/trivia/server.js b/src/trivia/server.js index 910f836..3c66050 100644 --- a/src/trivia/server.js +++ b/src/trivia/server.js @@ -1,4 +1,4 @@ -const uuidv4 = require('uuid/v4'); +const uuidv4 = require('uuid')["v4"]; const words = require('./words').words; const prompts = require('./prompts').prompts; -- cgit v1.2.3