diff --git a/src/fetchLeadsFromKeystone.js b/src/fetchLeadsFromKeystone.js index 1a1f6c1..8a08883 100644 --- a/src/fetchLeadsFromKeystone.js +++ b/src/fetchLeadsFromKeystone.js @@ -1,6 +1,5 @@ const path = require('path'); - -require('dotenv').config({ path: path.resolve(__dirname, '../.env') }); +const auth = require('../cfg/auth.js'); // this function retrieve the users' data from Keystone async function getLeads(lastRunDate, currentDate, unsent, test) { @@ -8,7 +7,7 @@ async function getLeads(lastRunDate, currentDate, unsent, test) { const response = await fetch('https://smarthub.keystoneacademic.com/api/rest/getLead', { method: 'POST', headers: { - 'x-api-key': process.env.KEYSTONE_API_KEY, + 'x-api-key': auth.apiKey, 'Accept': 'application/json', 'Content-type': 'application/json' },