backtrace-service
Advanced tools
Comparing version 1.3.0-beta.1 to 1.3.0-beta.2
@@ -9,3 +9,3 @@ import express from 'express'; | ||
private readonly port; | ||
private readonly _opts; | ||
private readonly _opts?; | ||
/** | ||
@@ -15,8 +15,10 @@ * Create and startup express application with basic options. | ||
* Backtrace service rules | ||
* @param opts application options | ||
* @param app (optional) express app. | ||
* @param name service name (required by service layer) | ||
* @param port service port (required by service layer) | ||
* @param opts optional application options | ||
* @param app optional express app instance | ||
* By using this parameter you can create express app in different | ||
* framework and still be able to use Backtrace integrations | ||
*/ | ||
static bootstrap<T extends {}>(name: string, port: number, opts: IAppOptions, app?: express.Express): BacktraceService<T>; | ||
static bootstrap<T extends {}>(name: string, port: number, opts?: IAppOptions, app?: express.Express): BacktraceService<T>; | ||
static readConfiguration<T = {}>(name: string, port: number, path?: string): IConfiguration<T>; | ||
@@ -46,5 +48,5 @@ /** | ||
private _descriptor; | ||
constructor(name: string, port: number, _opts: IAppOptions, app?: express.Express); | ||
constructor(name: string, port: number, _opts?: IAppOptions | undefined, app?: express.Express); | ||
start(): void; | ||
private prepareServiceLayer; | ||
} |
@@ -22,7 +22,10 @@ "use strict"; | ||
this.app = app ? app : express_1.default(); | ||
this.configuration = BacktraceService.readConfiguration(this.name, this.port, this._opts.confPath); | ||
this.configuration = BacktraceService.readConfiguration(this.name, this.port, this._opts && this._opts.confPath ? this._opts.confPath : undefined); | ||
var logLevel = this.configuration.logger && this.configuration.logger.logLevel | ||
? this.configuration.logger.logLevel | ||
: undefined; | ||
this._logger = _opts.logger ? _opts.logger : new logger_1.Logger(logLevel); | ||
this._logger = | ||
this._opts && this._opts.logger | ||
? this._opts.logger | ||
: new logger_1.Logger(logLevel); | ||
if (this.configuration.backtrace && | ||
@@ -40,4 +43,6 @@ this.configuration.backtrace.remoteLog === true) { | ||
* Backtrace service rules | ||
* @param opts application options | ||
* @param app (optional) express app. | ||
* @param name service name (required by service layer) | ||
* @param port service port (required by service layer) | ||
* @param opts optional application options | ||
* @param app optional express app instance | ||
* By using this parameter you can create express app in different | ||
@@ -44,0 +49,0 @@ * framework and still be able to use Backtrace integrations |
{ | ||
"name": "backtrace-service", | ||
"version": "1.3.0-beta.1", | ||
"version": "1.3.0-beta.2", | ||
"description": "Common tools for Backtrace Node services", | ||
@@ -5,0 +5,0 @@ "author": "Backtrace", |
@@ -24,4 +24,6 @@ import { json, urlencoded } from 'body-parser'; | ||
* Backtrace service rules | ||
* @param opts application options | ||
* @param app (optional) express app. | ||
* @param name service name (required by service layer) | ||
* @param port service port (required by service layer) | ||
* @param opts optional application options | ||
* @param app optional express app instance | ||
* By using this parameter you can create express app in different | ||
@@ -33,3 +35,3 @@ * framework and still be able to use Backtrace integrations | ||
port: number, | ||
opts: IAppOptions, | ||
opts?: IAppOptions, | ||
app?: express.Express, | ||
@@ -156,3 +158,3 @@ ): BacktraceService<T> { | ||
private readonly port: number, | ||
private readonly _opts: IAppOptions, | ||
private readonly _opts?: IAppOptions, | ||
app?: express.Express, | ||
@@ -164,3 +166,3 @@ ) { | ||
this.port, | ||
this._opts.confPath, | ||
this._opts && this._opts.confPath ? this._opts.confPath : undefined, | ||
); | ||
@@ -172,4 +174,8 @@ | ||
: undefined; | ||
this._logger = _opts.logger ? _opts.logger : new Logger(logLevel); | ||
this._logger = | ||
this._opts && this._opts.logger | ||
? this._opts.logger | ||
: new Logger(logLevel); | ||
if ( | ||
@@ -176,0 +182,0 @@ this.configuration.backtrace && |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
160450
2820