Skip to content

Commit

Permalink
level db to use a fixed database in production (#133)
Browse files Browse the repository at this point in the history
enabled cors
  • Loading branch information
fuxingloh authored May 31, 2021
1 parent 3e365d1 commit be14bc8
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
7 changes: 6 additions & 1 deletion apps/whale-api/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,12 @@ async function bootstrap (): Promise<void> {
AppModule.forRoot(),
newFastifyAdapter()
)
app.enableCors()
app.enableCors({
origin: '*',
methods: ['GET', 'PUT', 'POST', 'DELETE'],
allowedHeaders: ['Content-Type'],
maxAge: 60 * 24 * 7
})
await app.listen(3000, '0.0.0.0')
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ function mkdir (location: string): void {
useFactory: (configService: ConfigService): string => {
const location = configService.get(
'database.level.location',
`.level/unnamed/${Date.now()}`
process.env.NODE_ENV === 'production ' ? '.level/index' : `.level/unnamed/${Date.now()}`
)
mkdir(location)
return location
Expand Down

0 comments on commit be14bc8

Please sign in to comment.