Remove credentials
This commit is contained in:
parent
47a3cad3a8
commit
b1babe3c50
1
app.ts
1
app.ts
@ -1,6 +1,7 @@
|
||||
import express from "express";
|
||||
import path from 'path'
|
||||
import morgan from 'morgan'
|
||||
import 'dotenv/config'
|
||||
|
||||
const hostname = '127.0.0.1';
|
||||
const httpPort = 4080;
|
||||
|
@ -1,11 +1,34 @@
|
||||
import mysql from 'mysql2/promise'
|
||||
import mysql, { type PoolOptions } from 'mysql2/promise'
|
||||
|
||||
const pool = mysql.createPool({
|
||||
host: '192.168.0.11',
|
||||
port: 3306,
|
||||
user: 'myUsage',
|
||||
password: 'vEj8lFj22srB_(VG',
|
||||
database: 'my_general_db'
|
||||
});
|
||||
const poolOptions: PoolOptions = {
|
||||
host: "",
|
||||
port: 0,
|
||||
user: "",
|
||||
password: "",
|
||||
database: ""
|
||||
}
|
||||
|
||||
if (process.env.DBIP) {
|
||||
poolOptions.host = process.env.DBIP;
|
||||
}
|
||||
|
||||
if (process.env.DBPort) {
|
||||
poolOptions.port = parseInt(process.env.DBPort);
|
||||
}
|
||||
|
||||
if (process.env.DBUser) {
|
||||
poolOptions.user = process.env.DBUser;
|
||||
}
|
||||
|
||||
if (process.env.DBPassword) {
|
||||
poolOptions.password = process.env.DBPassword;
|
||||
}
|
||||
|
||||
if (process.env.DBDatabase) {
|
||||
poolOptions.database = process.env.DBDatabase;
|
||||
}
|
||||
|
||||
|
||||
const pool = mysql.createPool(poolOptions);
|
||||
|
||||
export default pool;
|
@ -9,6 +9,7 @@
|
||||
"dependencies": {
|
||||
"@types/express": "^4.17.21",
|
||||
"@types/morgan": "^1.9.9",
|
||||
"dotenv": "^16.4.5",
|
||||
"express": "^4.18.2",
|
||||
"hbs": "^4.2.0",
|
||||
"morgan": "~1.9.1",
|
||||
|
Loading…
x
Reference in New Issue
Block a user