@spinajs/configuration
Advanced tools
Comparing version 2.0.53 to 2.0.54
@@ -1,2 +0,2 @@ | ||
import { ConfigurationSource } from '@spinajs/configuration-common'; | ||
import { ConfigurationSource, IConfigLike } from '@spinajs/configuration-common'; | ||
export declare abstract class BaseFileSource extends ConfigurationSource { | ||
@@ -14,10 +14,10 @@ protected RunApp?: string; | ||
constructor(RunApp?: string, CustomConfigPaths?: string[], appBaseDir?: string); | ||
protected load(extension: string, callback: (file: string) => Promise<any>): Promise<{}>; | ||
protected load(extension: string, callback: (file: string) => Promise<unknown>): Promise<{}>; | ||
} | ||
export declare class JsFileSource extends BaseFileSource { | ||
Load(): Promise<any>; | ||
Load(): Promise<IConfigLike>; | ||
} | ||
export declare class JsonFileSource extends BaseFileSource { | ||
Load(): Promise<any>; | ||
Load(): Promise<IConfigLike>; | ||
} | ||
//# sourceMappingURL=sources.d.ts.map |
@@ -7,8 +7,2 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { | ||
}; | ||
/* eslint-disable @typescript-eslint/no-unsafe-argument */ | ||
/* eslint-disable @typescript-eslint/no-unsafe-call */ | ||
/* eslint-disable @typescript-eslint/require-await */ | ||
/* eslint-disable @typescript-eslint/no-unsafe-member-access */ | ||
/* eslint-disable @typescript-eslint/no-unsafe-return */ | ||
/* eslint-disable @typescript-eslint/no-explicit-any */ | ||
import { Injectable, DI } from '@spinajs/di'; | ||
@@ -88,3 +82,2 @@ import glob from 'glob'; | ||
const common = await this.load('!(*.dev|*.prod).{cjs,js}', _load); | ||
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment | ||
const dEnv = DI.get('process.env') ?? process.env; | ||
@@ -97,8 +90,7 @@ const fExt = dEnv.NODE_ENV && dEnv.NODE_ENV === 'development' ? '*.dev.{cjs,js}' : '*.prod.{cjs,js}'; | ||
InternalLogger.trace(`Trying to load file ${file}`, 'Configuration'); | ||
// eslint-disable -next-line security/detect-non-literal-require | ||
const res = await import(`file://${file}`); | ||
const res = (await import(`file://${file}`)); | ||
return res.default; | ||
} | ||
catch (err) { | ||
InternalLogger.error(err, `error loading configuration file ${file}`); | ||
InternalLogger.error(err, `error loading configuration file ${file}`, 'configuration'); | ||
return null; | ||
@@ -116,3 +108,2 @@ } | ||
const common = await this.load('!(*.dev|*.prod).json', _load); | ||
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment | ||
const dEnv = DI.get('process.env') ?? process.env; | ||
@@ -125,3 +116,3 @@ const fExt = dEnv.NODE_ENV && dEnv.NODE_ENV === 'development' ? '*.dev.json' : '*.prod.json'; | ||
InternalLogger.trace(`Trying to load file ${file}`, 'Configuration'); | ||
return JSON.parse(fs.readFileSync(file, 'utf-8')); | ||
return Promise.resolve(JSON.parse(fs.readFileSync(file, 'utf-8'))); | ||
} | ||
@@ -128,0 +119,0 @@ catch (err) { |
{ | ||
"name": "@spinajs/configuration", | ||
"version": "2.0.53", | ||
"version": "2.0.54", | ||
"description": "framework configuration module", | ||
@@ -49,6 +49,6 @@ "exports": "./lib/index.js", | ||
"dependencies": { | ||
"@spinajs/configuration-common": "^2.0.53", | ||
"@spinajs/di": "^2.0.53", | ||
"@spinajs/exceptions": "^2.0.53", | ||
"@spinajs/internal-logger": "^2.0.53", | ||
"@spinajs/configuration-common": "^2.0.54", | ||
"@spinajs/di": "^2.0.54", | ||
"@spinajs/exceptions": "^2.0.54", | ||
"@spinajs/internal-logger": "^2.0.54", | ||
"ajv": "^8.12.0", | ||
@@ -55,0 +55,0 @@ "ajv-formats": "^2.1.1", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
48797
662
2