feat: add docker compose, use @fennec/configuration.

This commit is contained in:
2021-10-31 14:53:11 +08:00
parent ece8ccf27a
commit 4b8bb47800
10 changed files with 599 additions and 469 deletions

View File

@ -26,7 +26,7 @@ import { TagsModule } from './tags/tags.module';
username: configService.get<string>('db.postgres.username'),
password: configService.get<string>('db.postgres.password'),
database: configService.get<string>('db.postgres.database'),
synchronize: true,
synchronize: false,
autoLoadEntities: true,
}),
inject: [ConfigService],

View File

@ -1,3 +1,4 @@
import { ServiceRegister } from '@fennec/configuration';
import { ValidationPipe } from '@nestjs/common';
import { ConfigService } from '@nestjs/config';
import { NestFactory } from '@nestjs/core';
@ -15,9 +16,11 @@ async function bootstrap() {
}),
);
app.useGlobalFilters(new HttpExceptionFilter());
await app.listen(configService.get<number>('http.port'));
const server = await app.listen(configService.get<number>('http.port', 0));
const port = server.address().port;
const register = new ServiceRegister({ etcd: { hosts: 'http://rpi:2379' } });
register.register('fennec/api', `http://localhost:${port}`);
register.register('api.fennec', `http://localhost:${port}`);
register.register('blog/api', `http://localhost:${port}`);
register.register('admin.blog/api', `http://localhost:${port}`);
register.register('api.blog', `http://localhost:${port}`);
}
bootstrap();