dynamic db type

This commit is contained in:
Julian Krauser 2024-08-26 17:00:23 +02:00
parent 2f5d9d3f01
commit c7e48c0334
3 changed files with 5 additions and 2 deletions

View file

@ -1,7 +1,7 @@
import "dotenv/config";
import "reflect-metadata";
import { DataSource } from "typeorm";
import { DB_HOST, DB_USERNAME, DB_PASSWORD, DB_NAME } from "./env.defaults";
import { DB_HOST, DB_USERNAME, DB_PASSWORD, DB_NAME, DB_TYPE } from "./env.defaults";
import { user } from "./entity/user";
import { refresh } from "./entity/refresh";
@ -14,7 +14,7 @@ import { Invite1724579024939 } from "./migrations/1724579024939-invite";
import { Permissions1724661484664 } from "./migrations/1724661484664-permissions";
const dataSource = new DataSource({
type: "mysql",
type: DB_TYPE as any,
host: process.env.NODE_ENV || process.env.DBMODE ? "localhost" : DB_HOST,
port: 3306,
username: DB_USERNAME,