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 express = require('express');
|
||||||
const mariadb = require('mariadb');
|
const mariadb = require('mariadb');
|
||||||
const cors = require('cors');
|
const cors = require('cors');
|
||||||
const dotenv = require('dotenv');
|
require('dotenv').config({ debug: true })
|
||||||
|
|
||||||
const app = express();
|
const app = express();
|
||||||
|
|
||||||
@ -24,8 +24,6 @@ const pool = mariadb.createPool({
|
|||||||
db
|
db
|
||||||
});
|
});
|
||||||
|
|
||||||
console.log(dbip + " is our database");
|
|
||||||
|
|
||||||
//Initialize pollrate variable
|
//Initialize pollrate variable
|
||||||
let pollrate = "5000"; // 5 Seconds
|
let pollrate = "5000"; // 5 Seconds
|
||||||
|
|
||||||
@ -70,8 +68,10 @@ async function testDatabaseConnection() {
|
|||||||
|
|
||||||
// Test the connection
|
// Test the connection
|
||||||
console.log('Database connection successful');
|
console.log('Database connection successful');
|
||||||
|
console.log(dbip + " is our database");
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('Database connection failed:', error.message);
|
console.error('Database connection failed:', error.message);
|
||||||
|
console.log("Tried database " + dbip);
|
||||||
} finally {
|
} finally {
|
||||||
// Ensure the connection is closed
|
// Ensure the connection is closed
|
||||||
if (connection) {
|
if (connection) {
|
||||||
|
12
package-lock.json
generated
12
package-lock.json
generated
@ -11,6 +11,7 @@
|
|||||||
"dependencies": {
|
"dependencies": {
|
||||||
"body-parser": "^1.20.2",
|
"body-parser": "^1.20.2",
|
||||||
"cors": "^2.8.5",
|
"cors": "^2.8.5",
|
||||||
|
"dotenv": "^16.4.5",
|
||||||
"express": "^4.19.2",
|
"express": "^4.19.2",
|
||||||
"mariadb": "^3.3.1",
|
"mariadb": "^3.3.1",
|
||||||
"nodemon": "^3.1.4"
|
"nodemon": "^3.1.4"
|
||||||
@ -264,6 +265,17 @@
|
|||||||
"npm": "1.2.8000 || >= 1.4.16"
|
"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": {
|
"node_modules/ee-first": {
|
||||||
"version": "1.1.1",
|
"version": "1.1.1",
|
||||||
"resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz",
|
"resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz",
|
||||||
|
@ -12,6 +12,7 @@
|
|||||||
"dependencies": {
|
"dependencies": {
|
||||||
"body-parser": "^1.20.2",
|
"body-parser": "^1.20.2",
|
||||||
"cors": "^2.8.5",
|
"cors": "^2.8.5",
|
||||||
|
"dotenv": "^16.4.5",
|
||||||
"express": "^4.19.2",
|
"express": "^4.19.2",
|
||||||
"mariadb": "^3.3.1",
|
"mariadb": "^3.3.1",
|
||||||
"nodemon": "^3.1.4"
|
"nodemon": "^3.1.4"
|
||||||
|
Loading…
Reference in New Issue
Block a user