aboutsummaryrefslogtreecommitdiff
path: root/src/index.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/index.js')
-rw-r--r--src/index.js11
1 files changed, 5 insertions, 6 deletions
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);