function to read from env
This commit is contained in:
parent
21711b960c
commit
d13b5933d0
3
api.js
3
api.js
|
@ -1,9 +1,10 @@
|
||||||
const got = require('got');
|
const got = require('got');
|
||||||
|
const { getEnvVar } = require('./env.js');
|
||||||
|
|
||||||
const fetchEvents = () =>
|
const fetchEvents = () =>
|
||||||
got('http://localhost:8384/rest/events', {
|
got('http://localhost:8384/rest/events', {
|
||||||
headers: {
|
headers: {
|
||||||
'X-API-Key': process.env.API_KEY,
|
'X-API-Key': getEnvVar('API_KEY','invalid')
|
||||||
},
|
},
|
||||||
}).json();
|
}).json();
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue