initial commit - far from runnable
This commit is contained in:
commit
db057ce342
8614 changed files with 1032171 additions and 0 deletions
26
src/data-source.ts
Normal file
26
src/data-source.ts
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
import "reflect-metadata";
|
||||
import { DataSource } from "typeorm";
|
||||
|
||||
import * as dotenv from "dotenv";
|
||||
import { UserEntity } from "./entities/UserEntity";
|
||||
|
||||
dotenv.config();
|
||||
|
||||
const { DB_HOST, DB_PORT, DB_USERNAME, DB_PASSWORD, DB_DATABASE, NODE_ENV } =
|
||||
process.env;
|
||||
|
||||
export const AppDataSource = new DataSource({
|
||||
type: "postgres",
|
||||
host: DB_HOST,
|
||||
port: parseInt(DB_PORT || "5432"),
|
||||
username: DB_USERNAME,
|
||||
password: DB_PASSWORD,
|
||||
database: DB_DATABASE,
|
||||
|
||||
synchronize: NODE_ENV === "dev" ? false : false,
|
||||
//logging logs sql command on the terminal
|
||||
logging: NODE_ENV === "dev" ? false : false,
|
||||
entities: [UserEntity],
|
||||
migrations: [__dirname + "/migration/*.ts"],
|
||||
subscribers: [],
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue