Move config to .env

This commit is contained in:
2023-05-24 16:44:15 +02:00
parent ad0fe7d599
commit 04f4b72b87
3 changed files with 20 additions and 4 deletions

16
package-lock.json generated
View File

@@ -10,7 +10,8 @@
"license": "ISC",
"dependencies": {
"axios": "^1.4.0",
"discord-webhook-node": "^1.1.8"
"discord-webhook-node": "^1.1.8",
"dotenv": "^16.0.3"
}
},
"node_modules/asynckit": {
@@ -69,6 +70,14 @@
"node": ">= 6"
}
},
"node_modules/dotenv": {
"version": "16.0.3",
"resolved": "https://registry.npmjs.org/dotenv/-/dotenv-16.0.3.tgz",
"integrity": "sha512-7GO6HghkA5fYG9TYnNxi14/7K9f5occMlp3zXAuSxn7CKCxt9xbNWG7yF8hTCSUchlfWSe3uLmlPfigevRItzQ==",
"engines": {
"node": ">=12"
}
},
"node_modules/follow-redirects": {
"version": "1.15.2",
"resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.2.tgz",
@@ -214,6 +223,11 @@
}
}
},
"dotenv": {
"version": "16.0.3",
"resolved": "https://registry.npmjs.org/dotenv/-/dotenv-16.0.3.tgz",
"integrity": "sha512-7GO6HghkA5fYG9TYnNxi14/7K9f5occMlp3zXAuSxn7CKCxt9xbNWG7yF8hTCSUchlfWSe3uLmlPfigevRItzQ=="
},
"follow-redirects": {
"version": "1.15.2",
"resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.2.tgz",

View File

@@ -11,6 +11,7 @@
"license": "ISC",
"dependencies": {
"axios": "^1.4.0",
"discord-webhook-node": "^1.1.8"
"discord-webhook-node": "^1.1.8",
"dotenv": "^16.0.3"
}
}

View File

@@ -1,12 +1,13 @@
require('dotenv').config()
const axios = require('axios');
const { STATUS_CODES } = require('http');
const { Webhook, MessageBuilder } = require('discord-webhook-node');
// API endpoint URL to ping
const apiUrl = 'https://toho.mnz.gg/api/v1/ping';
const apiUrl = process.env.API_URL;
// Discord webhook URL to send messages
const webhookUrl = 'https://discord.com/api/webhooks/1110880167536099328/GE6T1D81sGFvG08EOMdAo3sL1WIizowu-t78An0L9fcbgL6BAkoH0Lu74rtilS1KJUqO';
const webhookUrl = process.env.WEBHOOK;
// Create a new Discord webhook instance
const webhook = new Webhook(webhookUrl);