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