Refactor database configuration and enhance error handling in authentication services
Updated the database configuration to centralize settings and improve maintainability. Enhanced error handling in the authentication service to provide clearer and more specific error messages for various failure scenarios, including registration, activation, and login processes. Additionally, added new dependencies for testing and SQLite support in the package.json file.
This commit is contained in:
@@ -7,7 +7,7 @@ const __filename = fileURLToPath(import.meta.url);
|
||||
const __dirname = path.dirname(__filename);
|
||||
dotenv.config({ path: path.resolve(__dirname, '.env') });
|
||||
|
||||
export const development = {
|
||||
const baseConfig = {
|
||||
username: process.env.DB_USER || 'root',
|
||||
password: process.env.DB_PASSWORD || 'hitomisan',
|
||||
database: process.env.DB_NAME || 'trainingdiary',
|
||||
@@ -18,5 +18,12 @@ export const development = {
|
||||
underscored: true,
|
||||
underscoredAll: true,
|
||||
},
|
||||
logging: false,
|
||||
};
|
||||
|
||||
if (baseConfig.dialect === 'sqlite') {
|
||||
baseConfig.storage = process.env.DB_STORAGE || ':memory:';
|
||||
}
|
||||
|
||||
export const development = baseConfig;
|
||||
|
||||
Reference in New Issue
Block a user