uppercased environment variables
This commit is contained in:
parent
95c39eca7c
commit
470f9e0a25
2 changed files with 11 additions and 6 deletions
11
README.md
11
README.md
|
@ -26,9 +26,14 @@
|
||||||
`.env` file is needed due to docker compose. Even if you are not using docker and docker compose, **.ENV IS NEEDED**
|
`.env` file is needed due to docker compose. Even if you are not using docker and docker compose, **.ENV IS NEEDED**
|
||||||
the example .env is
|
the example .env is
|
||||||
```
|
```
|
||||||
webhook_url=<url_of_webhook>
|
WEBHOOK_URL=<webhook_url>
|
||||||
webhook_name=Flipper
|
<<<<<<< HEAD
|
||||||
webhook_profile_picture_link=https://cdn.discordapp.com/avatars/486155512568741900/164084b936b4461fe9505398f7383a0e.png?size=4096
|
WEBHOOK_NAME=Auction_Notifier
|
||||||
|
WEBHOOK_PROFILE_PICTURE=<picture_url>
|
||||||
|
=======
|
||||||
|
WEBHOOK_NAME=Flipper
|
||||||
|
WEBHOOK_PROFILE_PICTURE=https://cdn.discordapp.com/avatars/486155512568741900/164084b936b4461fe9505398f7383a0e.png?size=4096
|
||||||
|
>>>>>>> aad843d (uppercased environment variables)
|
||||||
```
|
```
|
||||||
You can also add these as environment variables into your system when running Node or run the app via `node --env-file=.env index.js`
|
You can also add these as environment variables into your system when running Node or run the app via `node --env-file=.env index.js`
|
||||||
|
|
||||||
|
|
6
index.js
6
index.js
|
@ -21,7 +21,7 @@ const bazaarPrice = {
|
||||||
};
|
};
|
||||||
|
|
||||||
async function initialize() {
|
async function initialize() {
|
||||||
const matches = process.env.webhook_url.match(webhookRegex);
|
const matches = process.env.WEBHOOK_URL.match(webhookRegex);
|
||||||
if (!matches) return console.log(`[Main thread] Couldn't parse Webhook URL`);
|
if (!matches) return console.log(`[Main thread] Couldn't parse Webhook URL`);
|
||||||
const webhook = new WebhookClient({ id: matches[1], token: matches[2] });
|
const webhook = new WebhookClient({ id: matches[1], token: matches[2] });
|
||||||
|
|
||||||
|
@ -70,8 +70,8 @@ async function initialize() {
|
||||||
);
|
);
|
||||||
|
|
||||||
await webhook.send({
|
await webhook.send({
|
||||||
username: process.env.webhook_name,
|
username: process.env.WEBHOOK_NAME,
|
||||||
avatarURL: process.env.webhook_profile_picture_link,
|
avatarURL: process.env.WEBHOOK_PROFILE_PICTURE,
|
||||||
embeds: [embed],
|
embeds: [embed],
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue