diff --git a/CHANGELOG.md b/CHANGELOG.md index 55c4c73..0c5285a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,13 @@ # Changelog +### Version 0.0.4 + +#### bugfix +* PR [#11](https://github.com/petercort/FBF-Event-Buddy/pull/11) - updating another thing + + + ### Version 0.0.3 #### enhancement diff --git a/argocd/pod.yaml b/argocd/pod.yaml new file mode 100644 index 0000000..e64655e --- /dev/null +++ b/argocd/pod.yaml @@ -0,0 +1,30 @@ +kind: Pod +apiVersion: v1 +metadata: + name: cool-test-pod + namespace: default +spec: + containers: + - name: busybox + image: registry.k8s.io/e2e-test-images/busybox:1.29-4 + command: + - "/bin/sleep" + - "10000" + volumeMounts: + - name: secrets-store01-inline + mountPath: "/mnt/secrets-store" + readOnly: true + resources: + requests: + cpu: 100m + memory: 128Mi + limits: + cpu: 250m + memory: 256Mi + volumes: + - name: secrets-store01-inline + csi: + driver: secrets-store.csi.k8s.io + readOnly: true + volumeAttributes: + secretProviderClass: "sc-demo-keyvault-csi" \ No newline at end of file diff --git a/config/event-buddy-deployment.yaml b/config/event-buddy-deployment.yaml index 32d5403..930c11d 100644 --- a/config/event-buddy-deployment.yaml +++ b/config/event-buddy-deployment.yaml @@ -14,10 +14,14 @@ spec: app: event-buddy spec: containers: - - image: ghcr.io/petercort/event-buddy:0.0.3 + - image: ghcr.io/petercort/event-buddy:0.0.4 name: event-buddy ports: - containerPort: 80 + - command: + - tail + - "-f" + - /dev/null volumeMounts: - name: azure-secrets-store mountPath: "/mnt/secrets-store" diff --git a/src/commands.js b/src/commands.js index 257c18f..fbf5256 100644 --- a/src/commands.js +++ b/src/commands.js @@ -2,7 +2,9 @@ const { REST, Routes } = require('discord.js'); require('dotenv').config() const fs = require('node:fs'); const path = require('node:path'); -const { appId, guildId, discordToken } = process.env; +const discordToken = fs.readFileSync("/mnt/secrets-store/discordToken", 'utf8'); +const guildId = fs.readFileSync("/mnt/secrets-store/guildId", 'utf8'); +const appId = fs.readFileSync("/mnt/secrets-store/APPID", 'utf8'); const commands = []; // Grab all the command folders from the commands directory you created earlier diff --git a/src/utils.js b/src/utils.js index 2b46c84..6856d87 100644 --- a/src/utils.js +++ b/src/utils.js @@ -1,14 +1,16 @@ import 'dotenv/config'; export async function DiscordRequest(endpoint, options) { + const discordToken = fs.readFileSync("/mnt/secrets-store/discordToken", 'utf8'); // append endpoint to root API URL const url = 'https://discord.com/api/v10/' + endpoint; // Stringify payloads if (options.body) options.body = JSON.stringify(options.body); + // Use fetch to make requests const res = await fetch(url, { headers: { - Authorization: `Bot ${process.env.discordToken}`, + Authorization: `Bot ${discordToken}`, 'Content-Type': 'application/json; charset=UTF-8', 'User-Agent': 'DiscordBot (https://github.com/petercort/fbf-event-buddy, 1.0.0)', },