mirror of
https://github.com/immich-app/immich.git
synced 2025-01-24 20:52:44 +01:00
cf9e04c8ec
* feat(server): audit log * feedback * Insert to database * migration * test * controller/repository/service * test * module * feat(server): implement audit endpoint * directly return changed assets * add daily cleanup of audit table * fix tests * review feedback * ci * refactor(server): audit implementation * chore: open api --------- Co-authored-by: Alex Tran <alex.tran1502@gmail.com> Co-authored-by: Fynn Petersen-Frey <zoodyy@users.noreply.github.com> Co-authored-by: Jason Rasmussen <jrasm91@gmail.com>
27 lines
963 B
TypeScript
27 lines
963 B
TypeScript
import { DataSource } from 'typeorm';
|
|
import { PostgresConnectionOptions } from 'typeorm/driver/postgres/PostgresConnectionOptions';
|
|
|
|
const url = process.env.DB_URL;
|
|
const urlOrParts = url
|
|
? { url }
|
|
: {
|
|
host: process.env.DB_HOSTNAME || 'localhost',
|
|
port: parseInt(process.env.DB_PORT || '5432'),
|
|
username: process.env.DB_USERNAME || 'postgres',
|
|
password: process.env.DB_PASSWORD || 'postgres',
|
|
database: process.env.DB_DATABASE_NAME || 'immich',
|
|
};
|
|
|
|
export const databaseConfig: PostgresConnectionOptions = {
|
|
type: 'postgres',
|
|
entities: [__dirname + '/entities/*.entity.{js,ts}'],
|
|
synchronize: false,
|
|
migrations: [__dirname + '/migrations/*.{js,ts}'],
|
|
subscribers: [__dirname + '/subscribers/*.{js,ts}'],
|
|
migrationsRun: true,
|
|
connectTimeoutMS: 10000, // 10 seconds
|
|
...urlOrParts,
|
|
};
|
|
|
|
// this export is used by TypeORM commands in package.json#scripts
|
|
export const dataSource = new DataSource(databaseConfig);
|