@piggly/fastify-chassis
Version:
An ESM/CommonJS toolkit to help you to do common operations in your back-end applications with Fastify and NodeJS.
71 lines • 1.73 kB
JavaScript
import { ServiceProvider } from '@piggly/ddd-toolkit';
/**
* @file The environment settings service.
* @since 5.0.0
*/
export class EnvironmentService {
/**
* The settings.
*
* @protected
* @memberof EnvironmentService
* @since 5.0.0
* @author Caique Araujo <caique@piggly.com.br>
*/
_settings;
/**
* Create a new environment settings service.
*
* @param settings The settings.
* @public
* @constructor
* @memberof EnvironmentService
* @since 5.0.0
* @author Caique Araujo <caique@piggly.com.br>
*/
constructor(settings) {
this._settings = settings;
}
/**
* Get the settings.
*
* @public
* @memberof EnvironmentService
* @since 5.0.0
* @author Caique Araujo <caique@piggly.com.br>
*/
get settings() {
return this._settings;
}
/**
* Register application service.
*
* @param {LoggerService} service
* @public
* @static
* @memberof LoggerService
* @since 5.0.0
* @author Caique Araujo <caique@piggly.com.br>
*/
static register(service) {
if (ServiceProvider.has('EnvironmentService')) {
return;
}
ServiceProvider.register('EnvironmentService', service);
}
/**
* Resolve application service.
*
* @returns {LoggerService}
* @throws {Error} If service is not registered.
* @public
* @static
* @memberof LoggerService
* @since 5.0.0
* @author Caique Araujo <caique@piggly.com.br>
*/
static resolve() {
return ServiceProvider.resolve('EnvironmentService');
}
}
//# sourceMappingURL=EnvironmentService.js.map