Commit 538c1d73 authored by Mike Street's avatar Mike Street
Browse files

Task: Utilise dotenv to avoid commiting API key

parent 21cb7dd5
# Local Netlify folder
.netlify
node_modules
\ No newline at end of file
node_modules
.env
\ No newline at end of file
{
"requires": true,
"name": "sitrep",
"version": "1.0.0",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
"dotenv": {
"version": "8.2.0",
"resolved": "https://registry.npmjs.org/dotenv/-/dotenv-8.2.0.tgz",
"integrity": "sha512-8sJ78ElpbDJBHNeBzUbUVLsqKdccaa/BXF1uPTw3GrvQTBgrQrtObr2mUrE38vzYd8cEv+m/JBfDLioYcfXoaw=="
},
"node-fetch": {
"version": "2.6.0",
"resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.0.tgz",
......
......@@ -4,6 +4,7 @@
"description": "",
"main": "sitrep.js",
"dependencies": {
"dotenv": "^8.2.0",
"node-fetch": "^2.6.0"
},
"devDependencies": {},
......
require('dotenv').config();
const fetch = require('node-fetch');
exports.handler = function(event) {
......@@ -14,7 +16,7 @@ exports.handler = function(event) {
method: 'GET',
headers: {
'content-type': 'application/json; charset=utf-8',
'authorization': 'Bearer xoxp-XXX'
'authorization': `Bearer ${process.env.SLACK_API_TOKEN}`
}
};
......
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