Skip to main content

Database Configurations

Make sure to add the database configurations in the src/config/database.ts file.

src/config/database.ts
import { env } from "@mongez/dotenv";
import { DatabaseConfigurations } from "@warlock.js/cascade";

const databaseConfigurations: DatabaseConfigurations = {
host: env("DB_HOST", "localhost"),
port: env("DB_PORT", 27017),
username: env("DB_USERNAME"),
password: env("DB_PASSWORD"),
database: env("DB_NAME"),
dbAuth: env("DB_AUTH"),
url: env("DB_URL"),
};

export default databaseConfigurations;

If the url is provided, then the other configurations will be ignored, otherwise, the url will be generated from the other configurations.

For more information about database configurations, please read Cascade Configurations.