db from config
This commit is contained in:
parent
1555334021
commit
27b5c1c6aa
@ -1,7 +1,6 @@
|
||||
import { Module } from '@nestjs/common';
|
||||
import { TypeOrmModule } from '@nestjs/typeorm';
|
||||
import { join } from 'path';
|
||||
import { ConfigModule } from '@nestjs/config';
|
||||
import { ConfigModule, ConfigService } from '@nestjs/config';
|
||||
import { AppController } from './app.controller';
|
||||
import { AppService } from './app.service';
|
||||
import { ObjectsModule } from './modules/objects/objects.module';
|
||||
@ -11,11 +10,10 @@ import configuration from './config/configuration';
|
||||
@Module({
|
||||
imports: [
|
||||
ConfigModule.forRoot({ isGlobal: true, load: [configuration] }),
|
||||
TypeOrmModule.forRoot({
|
||||
type: 'sqlite',
|
||||
database: join(__dirname, '..', 'data.db'),
|
||||
autoLoadEntities: true,
|
||||
synchronize: true,
|
||||
TypeOrmModule.forRootAsync({
|
||||
imports: [ConfigModule],
|
||||
useFactory: (config: ConfigService) => config.get('database'),
|
||||
inject: [ConfigService],
|
||||
}),
|
||||
ObjectsModule,
|
||||
ZoneModule,
|
||||
|
Loading…
Reference in New Issue
Block a user