diff --git a/scripts/loadTest.ts b/scripts/loadTest.ts index dfef421c2ef9308627bffe1fa0623aefb7371efb..0e83f79181cbb0fcd9a6ca071a7d3cc64ffa456c 100644 --- a/scripts/loadTest.ts +++ b/scripts/loadTest.ts @@ -27,7 +27,15 @@ 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{ + console.error("BLENDB_SCHEMA_FILE wasn't informed"); + process.exit(1); +} 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..6b7924161b5fdd54177eb7451d9afd675a2eb8e8 100644 --- a/src/api/controllers/collect.spec.ts +++ b/src/api/controllers/collect.spec.ts @@ -72,8 +72,16 @@ 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{ + console.error("BLENDB_SCHEMA_FILE wasn't informed"); + process.exit(1); + } config = ConfigParser.parse(configPath); eachOf(config.adapters , function(database, key: number, callback) { diff --git a/src/main.ts b/src/main.ts index 456e82a832904d641c98bc64acbe373950c61012..63f9c3d7c214b2cb7f721e93fc10b36b51452b22 100755 --- a/src/main.ts +++ b/src/main.ts @@ -36,8 +36,18 @@ 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{ + console.error("BLENDB_SCHEMA_FILE wasn't informed"); + process.exit(1); +} + /** @hidden */ const config = ConfigParser.parse(configPath); diff --git a/test/scenario.ts b/test/scenario.ts index 0cad7fa5f8fdf35f812b17962f0beb8405585252..dc058058682fb553514eb0d76390d6e30fb74c1f 100644 --- a/test/scenario.ts +++ b/test/scenario.ts @@ -29,7 +29,16 @@ 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{ + console.error("BLENDB_SCHEMA_FILE wasn't informed"); + process.exit(1); +} + const config = ConfigParser.parse(configPath); const mets : {[key: string]: Metric} = {};