Skip to content
Snippets Groups Projects
Commit 9a552e96 authored by Fabien Forestier's avatar Fabien Forestier
Browse files

Merge branch 'development' into 'master'

Version 1.2.4

See merge request refonte-data/service-email!6
parents 17e1eb2e c4fbcdbc
Branches
Tags
1 merge request!6Version 1.2.4
Pipeline #2435 passed
...@@ -24,3 +24,5 @@ npm-debug.log ...@@ -24,3 +24,5 @@ npm-debug.log
swagger-spec.json swagger-spec.json
dist/ dist/
.vscode
This diff is collapsed.
{ {
"name": "service-email", "name": "service-email",
"version": "1.2.3", "version": "1.2.4",
"description": "description", "description": "description",
"author": "", "author": "",
"license": "MIT", "license": "MIT",
...@@ -33,7 +33,6 @@ ...@@ -33,7 +33,6 @@
"reflect-metadata": "^0.1.12", "reflect-metadata": "^0.1.12",
"rxjs": "^6.2.2", "rxjs": "^6.2.2",
"serve-favicon": "^2.5.0", "serve-favicon": "^2.5.0",
"swagger-stats": "^0.95.7",
"typescript": "^3.0.1", "typescript": "^3.0.1",
"useragent": "^2.3.0" "useragent": "^2.3.0"
}, },
...@@ -72,4 +71,4 @@ ...@@ -72,4 +71,4 @@
"coverageDirectory": "../coverage", "coverageDirectory": "../coverage",
"testEnvironment": "node" "testEnvironment": "node"
} }
} }
\ No newline at end of file
import * as dotenv from 'dotenv';
import { config } from './config'; import { config } from './config';
export class ConfigService { export class ConfigService {
private _config = config; private _config = config;
constructor() { constructor() {
dotenv.config();
// Initializing conf with values from var env // Initializing conf with values from var env
this._config.smtpConfig.host = process.env.SMTP_HOST; this._config.smtpConfig.host = process.env.SMTP_HOST;
this._config.smtpConfig.port = process.env.SMTP_PORT; this._config.smtpConfig.port = process.env.SMTP_PORT;
......
...@@ -2,15 +2,13 @@ import { NestFactory } from '@nestjs/core'; ...@@ -2,15 +2,13 @@ import { NestFactory } from '@nestjs/core';
import { AppModule } from './app.module'; import { AppModule } from './app.module';
import { SwaggerModule, DocumentBuilder } from '@nestjs/swagger'; import { SwaggerModule, DocumentBuilder } from '@nestjs/swagger';
import { ValidationPipe } from '@nestjs/common'; import { ValidationPipe } from '@nestjs/common';
import * as swStats from 'swagger-stats';
import * as favicon from 'serve-favicon'; import * as favicon from 'serve-favicon';
import * as path from 'path'; import * as path from 'path';
import { AppLogger } from './app-logger'; import { AppLogger } from './app-logger';
async function bootstrap() { async function bootstrap() {
const app = await NestFactory.create(AppModule, { const app = await NestFactory.create(AppModule, {
logger: false, logger: new AppLogger(),
}); });
app.enableCors({ credentials: true, origin: true }); app.enableCors({ credentials: true, origin: true });
...@@ -21,20 +19,15 @@ async function bootstrap() { ...@@ -21,20 +19,15 @@ async function bootstrap() {
.setBasePath('') .setBasePath('')
.setTitle('Email service API') .setTitle('Email service API')
.setDescription('Service providing the method to send emails.') .setDescription('Service providing the method to send emails.')
.setVersion('0.1') .setVersion(process.env.npm_package_version)
.addTag('email') .addTag('email')
.build(); .build();
const document = SwaggerModule.createDocument(app, options); const document = SwaggerModule.createDocument(app, options);
// Enable stats middleware based on the generated swagger document
app.use(swStats.getMiddleware(document));
SwaggerModule.setup('api-doc', app, document); SwaggerModule.setup('api-doc', app, document);
app.useGlobalPipes(new ValidationPipe()); app.useGlobalPipes(new ValidationPipe());
app.useLogger(app.get(AppLogger));
await app.listen(3000); await app.listen(3000);
} }
bootstrap(); bootstrap();
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment