Skip to content
This repository was archived by the owner on Dec 14, 2022. It is now read-only.

Commit 91231e8

Browse files
author
Chris Wiechmann
committed
Update test_search_restricted.js
1 parent ac5fd79 commit 91231e8

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

apibuilder4elastic/test/trafficMonitorAPI/restricted/http/test_search_restricted.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,10 @@ describe('Endpoints', function () {
2323
return new Promise(function(resolve, reject){
2424
delete process.env.AUTHZ_CONFIG; // Make sure, it is not using from a previous test
2525
const envFilePath = path.join(__dirname, '../../../.env');
26-
const envLoadResult = envLoader.config({ path: envFilePath, debug: true });
27-
if (envLoadResult.error) {
28-
throw envLoadResult.error;
26+
// Make existing environment variables are overwritten (https://github.com/motdotla/dotenv#what-happens-to-environment-variables-that-were-already-set)
27+
const envConfig = dotenv.parse(fs.readFileSync(envFilePath));
28+
for (const k in envConfig) {
29+
process.env[k] = envConfig[k];
2930
}
3031
server = startApiBuilder();
3132
server.apibuilder.config.testElasticIndex = indexName;

0 commit comments

Comments
 (0)