Merge branch 'main' into feat/add-docs-workspace

This commit is contained in:
Amruth Pillai
2022-03-11 19:48:35 +01:00
132 changed files with 4243 additions and 308 deletions

View File

@ -31,15 +31,18 @@ FROM mcr.microsoft.com/playwright:focal as production
WORKDIR /app
RUN curl -f https://get.pnpm.io/v6.16.js | node - add --global pnpm
RUN apt-get update \
&& apt-get install -y curl \
&& curl -f https://get.pnpm.io/v6.16.js | node - add --global pnpm
COPY --from=builder /app/pnpm-*.yaml ./
COPY --from=builder /app/package.json ./
COPY --from=builder /app/server/dist ./server/dist
COPY --from=builder /app/server/package.json ./server/package.json
RUN pnpm install -F server --frozen-lockfile --prod
COPY --from=builder /app/server/dist ./server/dist
EXPOSE 3100
ENV PORT 3100

View File

@ -20,6 +20,7 @@
"@nestjs/platform-express": "^8.4.0",
"@nestjs/schedule": "^1.0.2",
"@nestjs/serve-static": "^2.2.2",
"@nestjs/terminus": "^8.0.4",
"@nestjs/typeorm": "^8.0.3",
"@sendgrid/mail": "^7.6.1",
"@types/passport": "^1.0.7",

View File

@ -9,6 +9,7 @@ import { ConfigModule } from './config/config.module';
import { DatabaseModule } from './database/database.module';
import { HttpExceptionFilter } from './filters/http-exception.filter';
import { FontsModule } from './fonts/fonts.module';
import { HealthModule } from './health/health.module';
import { IntegrationsModule } from './integrations/integrations.module';
import { MailModule } from './mail/mail.module';
import { PrinterModule } from './printer/printer.module';
@ -32,6 +33,7 @@ import { UsersModule } from './users/users.module';
FontsModule,
IntegrationsModule,
PrinterModule,
HealthModule,
],
providers: [
{

View File

@ -126,7 +126,7 @@ export class AuthService {
const UserInfoClient = google.oauth2('v2').userinfo;
const { data } = await UserInfoClient.get({ auth: OAuthClient });
const username = data.email.split('@').at(0);
const username = data.email.split('@')[0];
const createUserDto: CreateGoogleUserDto = {
name: `${data.given_name} ${data.family_name}`,

View File

@ -0,0 +1,21 @@
import { Controller, Get } from '@nestjs/common';
import { HealthCheck, HealthCheckService, HttpHealthIndicator, TypeOrmHealthIndicator } from '@nestjs/terminus';
@Controller('health')
export class HealthController {
constructor(
private health: HealthCheckService,
private db: TypeOrmHealthIndicator,
private http: HttpHealthIndicator
) {}
@Get()
@HealthCheck()
check() {
return this.health.check([
() => this.db.pingCheck('database'),
() => this.http.pingCheck('app', 'https://rxresu.me'),
() => this.http.pingCheck('docs', 'https://beta.rxresu.me'),
]);
}
}

View File

@ -0,0 +1,11 @@
import { HttpModule } from '@nestjs/axios';
import { Module } from '@nestjs/common';
import { TerminusModule } from '@nestjs/terminus';
import { HealthController } from './health.controller';
@Module({
imports: [HttpModule, TerminusModule],
controllers: [HealthController],
})
export class HealthModule {}

View File

@ -10,6 +10,7 @@ const bootstrap = async () => {
const app = await NestFactory.create<NestExpressApplication>(AppModule);
// Middleware
app.enableCors({ credentials: true });
app.enableShutdownHooks();
app.use(cookieParser());