diff --git a/scripts/loadTest.ts b/scripts/loadTest.ts index dfef421c2ef9308627bffe1fa0623aefb7371efb..4e8fe824f877ea12c74a6b6fde72225e8d3aa771 100644 --- a/scripts/loadTest.ts +++ b/scripts/loadTest.ts @@ -27,7 +27,14 @@ import { ConfigParser } from "../src/util/configParser"; let config: any; let fixture; -const configPath = process.env.BLENDB_SCHEMA_FILE; +let configPath; + +if(process.env.BLENDB_SCHEMA_FILE){ + configPath = process.env.BLENDB_SCHEMA_FILE; +} +else{ + throw new Error("BLENDB_SCHEMA_FILE wasn't informed"); +} config = ConfigParser.parse(configPath); fixture = new FixPostgres(config.connection); diff --git a/src/api/controllers/collect.spec.ts b/src/api/controllers/collect.spec.ts index d189bd571e97c6f3ae2d7040dd7bc16897fff513..9c57224d55234380aec621be9b5ed7b87ce12b07 100644 --- a/src/api/controllers/collect.spec.ts +++ b/src/api/controllers/collect.spec.ts @@ -72,8 +72,15 @@ function loadDb(db: string, index: number, cb: (err: any, result: Adapter) => vo describe("API collect controller", () => { // Initializing before(function (done): void { - // Arrow function not used to get acces to this and skip the test - const configPath = process.env.BLENDB_SCHEMA_FILE; + // Arrow function not used to get acces to this and skip the test + let configPath; + + if(process.env.BLENDB_SCHEMA_FILE){ + configPath = process.env.BLENDB_SCHEMA_FILE; + } + else{ + throw new Error("BLENDB_SCHEMA_FILE wasn't informed"); + } config = ConfigParser.parse(configPath); eachOf(config.adapters , function(database, key: number, callback) { diff --git a/src/main.ts b/src/main.ts index 456e82a832904d641c98bc64acbe373950c61012..0710b3cc5db45c3b2d378e021a10c0bc00c798f4 100755 --- a/src/main.ts +++ b/src/main.ts @@ -36,8 +36,17 @@ const app = module.exports = express(); // Load configuration file import { ConfigParser } from "./util/configParser"; + +let configPath; + /** @hidden */ -const configPath = process.env.BLENDB_SCHEMA_FILE; +if(process.env.BLENDB_SCHEMA_FILE){ + configPath = process.env.BLENDB_SCHEMA_FILE; +} +else{ + throw new Error("BLENDB_SCHEMA_FILE wasn't informed"); +} + /** @hidden */ const config = ConfigParser.parse(configPath); diff --git a/test/scenario.ts b/test/scenario.ts index 0cad7fa5f8fdf35f812b17962f0beb8405585252..ad807b8260b1ebd863689835d6785b63ead2eb92 100644 --- a/test/scenario.ts +++ b/test/scenario.ts @@ -29,7 +29,15 @@ import { ViewHandler } from "../src/util/viewHandler"; import { EngineScenario, AdapterScenario, DataCtrlScenario } from "../src/util/scenarioHandler"; import { Query, QueryOpts } from "../src/common/query"; -const configPath = process.env.BLENDB_SCHEMA_FILE; +let configPath; + +if(process.env.BLENDB_SCHEMA_FILE){ + configPath = process.env.BLENDB_SCHEMA_FILE; +} +else{ + throw new Error("BLENDB_SCHEMA_FILE wasn't informed"); +} + const config = ConfigParser.parse(configPath); const mets : {[key: string]: Metric} = {};