8 lines
329 B
TypeScript
8 lines
329 B
TypeScript
import type { DatabaseOptions } from "@/types/configuration/database-options";
|
|
|
|
export const constituteMongoURI = ({ username, password, host, port, database }: DatabaseOptions) => {
|
|
const dbConnection = `mongodb://${username}:${password}@${host}:${port}`;
|
|
|
|
return database ? `${dbConnection}/${database}` : dbConnection;
|
|
};
|