Skip to content
Snippets Groups Projects
Commit d1a0963a authored by rafaelatc3sl's avatar rafaelatc3sl
Browse files

Issue #98: Add verification to env variable


Signed-off-by: default avatarrafaelatc3sl <rpd17@c3sl>
parent a3bf602b
No related branches found
No related tags found
1 merge request!83Issue #98: Add verification to env variable
Pipeline #19106 passed
...@@ -27,7 +27,14 @@ import { ConfigParser } from "../src/util/configParser"; ...@@ -27,7 +27,14 @@ import { ConfigParser } from "../src/util/configParser";
let config: any; let config: any;
let fixture; 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); config = ConfigParser.parse(configPath);
fixture = new FixPostgres(config.connection); fixture = new FixPostgres(config.connection);
......
...@@ -72,8 +72,15 @@ function loadDb(db: string, index: number, cb: (err: any, result: Adapter) => vo ...@@ -72,8 +72,15 @@ function loadDb(db: string, index: number, cb: (err: any, result: Adapter) => vo
describe("API collect controller", () => { describe("API collect controller", () => {
// Initializing // Initializing
before(function (done): void { before(function (done): void {
// Arrow function not used to get acces to this and skip the test // Arrow function not used to get acces to this and skip the test
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); config = ConfigParser.parse(configPath);
eachOf(config.adapters , function(database, key: number, callback) { eachOf(config.adapters , function(database, key: number, callback) {
......
...@@ -36,8 +36,17 @@ const app = module.exports = express(); ...@@ -36,8 +36,17 @@ const app = module.exports = express();
// Load configuration file // Load configuration file
import { ConfigParser } from "./util/configParser"; import { ConfigParser } from "./util/configParser";
let configPath;
/** @hidden */ /** @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 */ /** @hidden */
const config = ConfigParser.parse(configPath); const config = ConfigParser.parse(configPath);
......
...@@ -29,7 +29,15 @@ import { ViewHandler } from "../src/util/viewHandler"; ...@@ -29,7 +29,15 @@ import { ViewHandler } from "../src/util/viewHandler";
import { EngineScenario, AdapterScenario, DataCtrlScenario } from "../src/util/scenarioHandler"; import { EngineScenario, AdapterScenario, DataCtrlScenario } from "../src/util/scenarioHandler";
import { Query, QueryOpts } from "../src/common/query"; 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 config = ConfigParser.parse(configPath);
const mets : {[key: string]: Metric} = {}; const mets : {[key: string]: Metric} = {};
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment