Skip to content

Commit 863b3a0

Browse files
authored
issue#257 | Add env var to store env var names
1 parent e25fd8e commit 863b3a0

File tree

4 files changed

+25
-20
lines changed

4 files changed

+25
-20
lines changed

.github/workflows/register-commands-production.yaml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,17 @@ jobs:
1010
- uses: actions/checkout@v2
1111
- run: bash environment-variables-validator.sh
1212
env:
13+
ENV_VAR_NAMES: |
14+
DISCORD_APPLICATION_ID
15+
DISCORD_GUILD_ID
16+
DISCORD_TOKEN
17+
DISCORD_PUBLIC_KEY
18+
CLOUDFLARE_API_TOKEN
19+
CLOUDFLARE_ACCOUNT_ID
20+
BOT_PRIVATE_KEY
21+
RDS_SERVERLESS_PUBLIC_KEY
22+
CRON_JOBS_PUBLIC_KEY
23+
IDENTITY_SERVICE_PUBLIC_KEY
1324
DISCORD_APPLICATION_ID: ${{secrets.DISCORD_APPLICATION_ID}}
1425
DISCORD_GUILD_ID: ${{secrets.DISCORD_GUILD_ID}}
1526
DISCORD_TOKEN: ${{secrets.DISCORD_TOKEN}}

.github/workflows/register-commands-staging.yaml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,17 @@ jobs:
1010
- uses: actions/checkout@v2
1111
- run: bash environment-variables-validator.sh
1212
env:
13+
ENV_VAR_NAMES: |
14+
DISCORD_APPLICATION_ID
15+
DISCORD_GUILD_ID
16+
DISCORD_TOKEN
17+
DISCORD_PUBLIC_KEY
18+
CLOUDFLARE_API_TOKEN
19+
CLOUDFLARE_ACCOUNT_ID
20+
BOT_PRIVATE_KEY
21+
RDS_SERVERLESS_PUBLIC_KEY
22+
CRON_JOBS_PUBLIC_KEY
23+
IDENTITY_SERVICE_PUBLIC_KEY
1324
DISCORD_APPLICATION_ID: ${{secrets.DISCORD_APPLICATION_ID}}
1425
DISCORD_GUILD_ID: ${{secrets.DISCORD_GUILD_ID}}
1526
DISCORD_TOKEN: ${{secrets.DISCORD_TOKEN}}

environment-variables-validator.sh

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,10 @@
11
#!/bin/bash
22

3-
ENV_VARS_FILE="environment-variables.txt"
4-
# Check if the file exists
5-
if [[ ! -f "$ENV_VARS_FILE" ]]; then
6-
echo "File $ENV_VARS_FILE does not exist."
7-
exit 1
8-
fi
9-
10-
# Read the file and iterate through each variable name
11-
while IFS= read -r var_name; do
3+
for var_name in $ENV_VAR_NAMES; do
124
# Check if the variable is set in the environment
135
if [[ -z "${!var_name}" ]]; then
146
echo "Environment variable $var_name is not set."
157
exit 1 # Exit with error if any variable is not set
168
fi
17-
done < "$ENV_VARS_FILE"
9+
done
10+
echo "All Environment variables are set."

environment-variables.txt

Lines changed: 0 additions & 10 deletions
This file was deleted.

0 commit comments

Comments
 (0)