Files
adastra_api/src/config/db.config.js
T
2025-08-15 23:24:41 +02:00

28 lines
713 B
JavaScript

const dotenv = require('dotenv');
dotenv.config();
// configuration for the database connection based on the environment (development, test, production)
module.exports = {
development: {
use_env_variable: 'MYSQL_DATABASE_URL_DEV',
},
test: {
use_env_variable: 'MYSQL_DATABASE_URL_DEV',
dialect: "mysql",
dialectOptions: {
ssl: process.env.NODE_ENV === 'production', // set this value based on your environment
},
},
production: {
use_env_variable: 'MYSQL_DATABASE_URL',
dialectOptions: {
ssl: {
// enable this for production environment only if using a secure connection
require: true,
rejectUnauthorized: false,
},
},
},
};