2022-06-29 13:39:58 -05:00
|
|
|
import { PostgresConnectionOptions } from 'typeorm/driver/postgres/PostgresConnectionOptions';
|
2022-07-16 10:54:00 -05:00
|
|
|
import { DataSource } from 'typeorm';
|
2022-02-03 10:06:44 -06:00
|
|
|
|
2022-06-29 13:39:58 -05:00
|
|
|
export const databaseConfig: PostgresConnectionOptions = {
|
2022-02-03 10:06:44 -06:00
|
|
|
type: 'postgres',
|
2022-05-20 01:30:47 +02:00
|
|
|
host: process.env.DB_HOSTNAME || 'immich_postgres',
|
2022-07-13 05:21:11 +02:00
|
|
|
port: parseInt(process.env.DB_PORT || '5432'),
|
2022-02-03 10:06:44 -06:00
|
|
|
username: process.env.DB_USERNAME,
|
|
|
|
password: process.env.DB_PASSWORD,
|
2022-02-03 14:42:27 -06:00
|
|
|
database: process.env.DB_DATABASE_NAME,
|
2022-02-03 10:06:44 -06:00
|
|
|
entities: [__dirname + '/../**/*.entity.{js,ts}'],
|
2022-02-19 22:42:10 -06:00
|
|
|
synchronize: false,
|
2022-06-11 16:12:06 -05:00
|
|
|
migrations: [__dirname + '/../migrations/*.{js,ts}'],
|
2022-02-19 22:42:10 -06:00
|
|
|
migrationsRun: true,
|
2022-02-03 10:06:44 -06:00
|
|
|
};
|
2022-06-06 18:16:03 +02:00
|
|
|
|
2022-07-04 20:20:43 +01:00
|
|
|
export const dataSource = new DataSource(databaseConfig);
|