-
Notifications
You must be signed in to change notification settings - Fork 354
/
auth.js
26 lines (24 loc) · 929 Bytes
/
auth.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
var AuthDetails = {};
try {
AuthDetails = require("./auth.json");
} catch (e){
console.log("Please create an auth.json like auth.json.example with a bot token or an email and password.\n"+e.stack); // send message for error - no token
}
if(!AuthDetails.hasOwnProperty('bot_token')) {
//attempt to populate from ENV variables. useful for remote cloud deploys
AuthDetails = {
bot_token: process.env.bot_token,
client_id: process.env.client_id,
youtube_api_key: process.env.youtube_api_key,
google_custom_search: process.env.youtube_api_key,
imgflip_username: process.env.imgflip_username,
imgflip_password: process.env.imgflip_password,
wolfram_api_key: process.env.wolfram_api_key,
twitch_client_id: process.env.twitch_client_id,
spotify_client_id: process.env.spotify_client_id,
spotify_client_secret: process.env.spotify_client_secret
}
}
exports.getAuthDetails = () => {
return AuthDetails;
}