Commit 234cb7ee authored by Rafael Dias's avatar Rafael Dias

Issue #86: Add environment variable for yaml files

Signed-off-by: Rafael Dias's avatarRafael <rpd17@inf.ufpr.br>
parent 87ba0061
Pipeline #17435 passed with stages
in 1 minute and 4 seconds
...@@ -28,7 +28,6 @@ run_test_postgres: ...@@ -28,7 +28,6 @@ run_test_postgres:
stage: test stage: test
script: script:
- yarn install --frozen-lockfile --silent --non-interactive - yarn install --frozen-lockfile --silent --non-interactive
- mv config/ci_test.yaml.example config/test.yaml
- mv config/ci_postgres_test.env.example config/test.env - mv config/ci_postgres_test.env.example config/test.env
- yarn test - yarn test
- yarn run lint - yarn run lint
...@@ -40,7 +39,6 @@ run_test_monet: ...@@ -40,7 +39,6 @@ run_test_monet:
stage: test stage: test
script: script:
- yarn install --frozen-lockfile --silent --non-interactive - yarn install --frozen-lockfile --silent --non-interactive
- mv config/ci_test.yaml.example config/test.yaml
- mv config/ci_monet_test.env.example config/test.env - mv config/ci_monet_test.env.example config/test.env
- yarn test - yarn test
- yarn run lint - yarn run lint
......
...@@ -4,4 +4,5 @@ BLENDB_DB_PASSWORD=monetdb ...@@ -4,4 +4,5 @@ BLENDB_DB_PASSWORD=monetdb
BLENDB_DB_HOST=monet BLENDB_DB_HOST=monet
BLENDB_DB_PORT=50000 BLENDB_DB_PORT=50000
BLENDB_ADAPTER=monet BLENDB_ADAPTER=monet
BLENDB_SCHEMA_FILE=config/ci_test.yaml.example
PORT=3000 PORT=3000
...@@ -4,4 +4,5 @@ BLENDB_DB_PASSWORD= ...@@ -4,4 +4,5 @@ BLENDB_DB_PASSWORD=
BLENDB_DB_HOST=postgres BLENDB_DB_HOST=postgres
BLENDB_DB_PORT=5432 BLENDB_DB_PORT=5432
BLENDB_ADAPTER=postgres BLENDB_ADAPTER=postgres
BLENDB_SCHEMA_FILE=config/ci_test.yaml.example
PORT=3000 PORT=3000
...@@ -4,4 +4,5 @@ BLENDB_DB_PASSWORD=secret ...@@ -4,4 +4,5 @@ BLENDB_DB_PASSWORD=secret
BLENDB_DB_HOST=localhost BLENDB_DB_HOST=localhost
BLENDB_DB_PORT=5432 BLENDB_DB_PORT=5432
BLENDB_ADAPTER=postgres BLENDB_ADAPTER=postgres
BLENDB_SCHEMA_FILE=config/config.yaml
PORT=3000 PORT=3000
...@@ -36,7 +36,8 @@ describe("Sql adapter", () => { ...@@ -36,7 +36,8 @@ describe("Sql adapter", () => {
let fixture; let fixture;
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
config = ConfigParser.parse("config/test.yaml"); const configPath = process.env.BLENDB_SCHEMA_FILE;
config = ConfigParser.parse(configPath);
if (config.adapter === "postgres") { if (config.adapter === "postgres") {
fixture = new FixPostgres(config.connection); fixture = new FixPostgres(config.connection);
......
...@@ -36,7 +36,8 @@ describe("API collect controller", () => { ...@@ -36,7 +36,8 @@ describe("API collect controller", () => {
let fixture; let fixture;
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
config = ConfigParser.parse("config/test.yaml"); const configPath = process.env.BLENDB_SCHEMA_FILE;
config = ConfigParser.parse(configPath);
if (config.adapter === "postgres") { if (config.adapter === "postgres") {
fixture = new FixPostgres(config.connection); fixture = new FixPostgres(config.connection);
fixture.loadSource(config.sources, (err) => { fixture.loadSource(config.sources, (err) => {
......
...@@ -37,7 +37,7 @@ const app = module.exports = express(); ...@@ -37,7 +37,7 @@ const app = module.exports = express();
import { ConfigParser } from "./util/configParser"; import { ConfigParser } from "./util/configParser";
/** @hidden */ /** @hidden */
const configPath = (app.get("env") === "test") ? "config/test.yaml" : "config/config.yaml"; const configPath = process.env.BLENDB_SCHEMA_FILE;
/** @hidden */ /** @hidden */
const config = ConfigParser.parse(configPath); const config = ConfigParser.parse(configPath);
......
...@@ -66,7 +66,8 @@ interface DataCtrlScenario { ...@@ -66,7 +66,8 @@ interface DataCtrlScenario {
clausal: Query; clausal: Query;
} }
const config = ConfigParser.parse("config/test.yaml"); const configPath = process.env.BLENDB_SCHEMA_FILE;
const config = ConfigParser.parse(configPath);
const mets = config.metrics.sort((a, b) => { const mets = config.metrics.sort((a, b) => {
const aValue = parseInt(a.name.split(":")[1], 10); const aValue = parseInt(a.name.split(":")[1], 10);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment