26 lines
822 B
TypeScript
26 lines
822 B
TypeScript
|
import "dotenv/config";
|
||
|
import "reflect-metadata";
|
||
|
import { DataSource } from "typeorm";
|
||
|
import { user } from "./entity/user";
|
||
|
import { refresh } from "./entity/refresh";
|
||
|
import { Initial1724317398939 } from "./migrations/1724317398939-initial";
|
||
|
|
||
|
const dataSource = new DataSource({
|
||
|
type: "mysql",
|
||
|
host: process.env.NODE_ENV || process.env.DBMODE ? "localhost" : process.env.DB_HOST,
|
||
|
port: 3306,
|
||
|
username: process.env.DB_USERNAME,
|
||
|
password: process.env.DB_PASSWORD,
|
||
|
database: process.env.DB_NAME,
|
||
|
synchronize: false,
|
||
|
logging: process.env.NODE_ENV ? true : ["schema", "error", "warn", "log", "migration"],
|
||
|
bigNumberStrings: false,
|
||
|
entities: [user, refresh],
|
||
|
migrations: [Initial1724317398939],
|
||
|
migrationsRun: true,
|
||
|
migrationsTransactionMode: "each",
|
||
|
subscribers: [],
|
||
|
});
|
||
|
|
||
|
export { dataSource };
|