Modified the database connection to work properly lol

This commit is contained in:
Donavon McDowell 2024-11-29 09:34:36 -07:00
parent f5a9ef016a
commit ba82eeb17a

13
app.js
View File

@ -10,18 +10,19 @@ app.use(cors());
const version = "V1.1"; const version = "V1.1";
// Database configuration from environment variables or defaults
const dbip = process.env.DBIP || "192.168.2.55"; const dbip = process.env.DBIP || "192.168.2.55";
const dbusername = process.env.DBUSERNAME || "root"; const dbusername = process.env.DBUSERNAME || "root";
const dbpassword = process.env.DBPASSWORD || "U&P7UH1mhRG@JF2K"; const dbpassword = process.env.DBPASSWORD || "U&P7UH1mhRG@JF2K";
const db = process.env.DB || "LicenseTracker"; const db = process.env.DB || "LicenseTracker";
// Create a MariaDB connection pool
// Database details
const pool = mariadb.createPool({ const pool = mariadb.createPool({
dbip, host: dbip,
dbusername, user: dbusername,
dbpassword, password: dbpassword,
db database: db,
connectionLimit: 5 // Optional: Limit for maximum simultaneous connections
}); });
//Initialize pollrate variable //Initialize pollrate variable