mirror of
https://github.com/donavon04/licensetrackerbackend.git
synced 2025-01-18 00:30:57 -07:00
Add.env support
This commit is contained in:
parent
b1fa4b6238
commit
eca7b25d69
6
app.js
6
app.js
@ -1,7 +1,7 @@
|
||||
const express = require('express');
|
||||
const mariadb = require('mariadb');
|
||||
const cors = require('cors');
|
||||
const dotenv = require('dotenv');
|
||||
require('dotenv').config({ debug: true })
|
||||
|
||||
const app = express();
|
||||
|
||||
@ -24,8 +24,6 @@ const pool = mariadb.createPool({
|
||||
db
|
||||
});
|
||||
|
||||
console.log(dbip + " is our database");
|
||||
|
||||
//Initialize pollrate variable
|
||||
let pollrate = "5000"; // 5 Seconds
|
||||
|
||||
@ -70,8 +68,10 @@ async function testDatabaseConnection() {
|
||||
|
||||
// Test the connection
|
||||
console.log('Database connection successful');
|
||||
console.log(dbip + " is our database");
|
||||
} catch (error) {
|
||||
console.error('Database connection failed:', error.message);
|
||||
console.log("Tried database " + dbip);
|
||||
} finally {
|
||||
// Ensure the connection is closed
|
||||
if (connection) {
|
||||
|
12
package-lock.json
generated
12
package-lock.json
generated
@ -11,6 +11,7 @@
|
||||
"dependencies": {
|
||||
"body-parser": "^1.20.2",
|
||||
"cors": "^2.8.5",
|
||||
"dotenv": "^16.4.5",
|
||||
"express": "^4.19.2",
|
||||
"mariadb": "^3.3.1",
|
||||
"nodemon": "^3.1.4"
|
||||
@ -264,6 +265,17 @@
|
||||
"npm": "1.2.8000 || >= 1.4.16"
|
||||
}
|
||||
},
|
||||
"node_modules/dotenv": {
|
||||
"version": "16.4.5",
|
||||
"resolved": "https://registry.npmjs.org/dotenv/-/dotenv-16.4.5.tgz",
|
||||
"integrity": "sha512-ZmdL2rui+eB2YwhsWzjInR8LldtZHGDoQ1ugH85ppHKwpUHL7j7rN0Ti9NCnGiQbhaZ11FpR+7ao1dNsmduNUg==",
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://dotenvx.com"
|
||||
}
|
||||
},
|
||||
"node_modules/ee-first": {
|
||||
"version": "1.1.1",
|
||||
"resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz",
|
||||
|
@ -12,6 +12,7 @@
|
||||
"dependencies": {
|
||||
"body-parser": "^1.20.2",
|
||||
"cors": "^2.8.5",
|
||||
"dotenv": "^16.4.5",
|
||||
"express": "^4.19.2",
|
||||
"mariadb": "^3.3.1",
|
||||
"nodemon": "^3.1.4"
|
||||
|
Loading…
Reference in New Issue
Block a user