Skip to content

Commit

Permalink
Add mechanism to load in more env vars
Browse files Browse the repository at this point in the history
  • Loading branch information
mathew-fleisch committed Jul 22, 2021
1 parent 6766442 commit ee7638d
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
1 change: 1 addition & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ FROM mathewfleisch/tools:latest
# See this repo for the parent Dockerfile: https://github.com/mathew-fleisch/tools
LABEL maintainer="Mathew Fleisch <[email protected]>"
ENV BASHBOT_CONFIG_FILEPATH=/bashbot/config.json
ENV BASHBOT_ENV_VARS_FILEPATH ""
ENV SLACK_TOKEN ""
ENV LOG_LEVEL "info"
ENV LOG_FORMAT "text"
Expand Down
8 changes: 3 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ Slack's permissions model has changed and the "[RTM](https://api.slack.com/rtm)"
- curl

```bash
# Download the latest version of bashbot
# Download and install the latest version of bashbot
make install-latest
# or manually (without golang)
os=$(uname | tr '[:upper:]' '[:lower:]')
Expand Down Expand Up @@ -107,6 +107,8 @@ export BASHBOT_CONFIG_FILEPATH=${PWD}/config.json
docker run \
-v ${PWD}/config.json:/bashbot/config.json \
-e BASHBOT_CONFIG_FILEPATH "/bashbot/config.json" \
-v ${PWD}/.env:/bashbot/.env \
-e BASHBOT_CONFIG_FILEPATH "/bashbot/.env" \
-e SLACK_TOKEN $SLACK_TOKEN \
-e LOG_LEVEL "info" \
-e LOG_FORMAT "text" \
Expand All @@ -120,10 +122,6 @@ docker run \
- kubernetes

```yaml
#
###################################################
#
# Step 3c: Deploy Bashbot via kubernetes
---
apiVersion: apps/v1
kind: Deployment
Expand Down
6 changes: 6 additions & 0 deletions entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,17 @@ if ! [ -f "$BASHBOT_CONFIG_FILEPATH" ]; then
exit 1
fi

# If .env file is present, load it.
if [ -f "$BASHBOT_ENV_VARS_FILEPATH" ]; then
. "$BASHBOT_ENV_VARS_FILEPATH"
fi

if [ -z "$SLACK_TOKEN" ]; then
echo "SLACK_TOKEN is not set. Please set it and try again."
exit 1
fi


# If the log-level doesn't exist, set it to 'info'
LOG_LEVEL=${LOG_LEVEL:-info}
# If the log-format doesn't exist, set it to 'text'
Expand Down

0 comments on commit ee7638d

Please sign in to comment.