fix sqlite base definition
This commit is contained in:
parent
e9e53b4149
commit
cc23244c0f
@ -105,11 +105,15 @@ export const imports = [
|
|||||||
TypeOrmModule.forRootAsync({
|
TypeOrmModule.forRootAsync({
|
||||||
imports: [ConfigModule],
|
imports: [ConfigModule],
|
||||||
inject: [ConfigService],
|
inject: [ConfigService],
|
||||||
useFactory: (configService: ConfigService): TypeOrmModuleOptions => ({
|
useFactory: (configService: ConfigService): TypeOrmModuleOptions => {
|
||||||
|
const type: any = configService.get<string>('DATABASE_DRIVER', 'sqlite')
|
||||||
|
|
||||||
|
return ({
|
||||||
name: 'ohmyform',
|
name: 'ohmyform',
|
||||||
synchronize: false,
|
synchronize: false,
|
||||||
type: configService.get<string>('DATABASE_DRIVER', 'sqlite') as any,
|
type,
|
||||||
url: configService.get<string>('DATABASE_URL', 'sqlite://data.sqlite'),
|
url: configService.get<string>('DATABASE_URL'),
|
||||||
|
database: type === 'sqlite' ? configService.get<string>('DATABASE_URL', 'data.sqlite').replace('sqlite://', '') : undefined,
|
||||||
ssl: configService.get<string>('DATABASE_SSL', 'false') === 'true' ? { rejectUnauthorized: false } : false,
|
ssl: configService.get<string>('DATABASE_SSL', 'false') === 'true' ? { rejectUnauthorized: false } : false,
|
||||||
entityPrefix: configService.get<string>('DATABASE_TABLE_PREFIX', ''),
|
entityPrefix: configService.get<string>('DATABASE_TABLE_PREFIX', ''),
|
||||||
logging: configService.get<string>('DATABASE_LOGGING', 'false') === 'true',
|
logging: configService.get<string>('DATABASE_LOGGING', 'false') === 'true',
|
||||||
@ -118,7 +122,8 @@ export const imports = [
|
|||||||
`${__dirname}/**/migrations/**/*{.ts,.js}`,
|
`${__dirname}/**/migrations/**/*{.ts,.js}`,
|
||||||
],
|
],
|
||||||
migrationsRun: configService.get<boolean>('DATABASE_MIGRATE', true),
|
migrationsRun: configService.get<boolean>('DATABASE_MIGRATE', true),
|
||||||
}),
|
})
|
||||||
|
},
|
||||||
}),
|
}),
|
||||||
TypeOrmModule.forFeature(entities),
|
TypeOrmModule.forFeature(entities),
|
||||||
MailerModule.forRootAsync({
|
MailerModule.forRootAsync({
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user