mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-11 00:28:49 +00:00
32 lines
659 B
TypeScript
32 lines
659 B
TypeScript
import mongoose from 'mongoose';
|
|
import { getLogger } from '../utils/logger';
|
|
import {
|
|
initDatabaseHelper,
|
|
closeDatabaseHelper
|
|
} from '../helpers/database';
|
|
|
|
/**
|
|
* Class to handle database actions
|
|
*/
|
|
class DatabaseService {
|
|
/**
|
|
* Initialize database connection
|
|
* @param {Object} obj
|
|
* @param {String} obj.mongoURL - mongo connection string
|
|
* @returns
|
|
*/
|
|
static async initDatabase(MONGO_URL: string) {
|
|
return await initDatabaseHelper({
|
|
mongoURL: MONGO_URL
|
|
});
|
|
}
|
|
|
|
/**
|
|
* Close database conection
|
|
*/
|
|
static async closeDatabase() {
|
|
return await closeDatabaseHelper();
|
|
}
|
|
}
|
|
|
|
export default DatabaseService; |