Skip to content

Commit

Permalink
feat: add additional config to the dockerfile (#71)
Browse files Browse the repository at this point in the history
This adds to the dockerfile's config to automatically load additional
config from the environment
  • Loading branch information
andrewthetechie authored May 4, 2024
1 parent 3328fb0 commit 3fe60b8
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ COPY .github/workflows/constraints.txt /constraints.txt
RUN pip install --upgrade --constraint /constraints.txt pip poetry
COPY ./ /app
WORKDIR /app
RUN poetry build
RUN rm -rf dist && poetry build

from python:3.11-slim
ARG ERRBOT_VERSION=6.2.0
Expand Down
3 changes: 3 additions & 0 deletions docker/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ SUPPRESS_CMD_NOT_FOUND is set to true, this means the bot will just not respond

BOT_PREFIX_OPTIONAL_ON_CHAT is set to true, this means that commands can be run with the prefix

Any environment variable that is proceeded with "ERR_APRS_" will get added to the config automatically. For example "ERR_ARPS_FOO=bar" will result in `FOO="bar` in
the errbot config

## Plugins

Plugins can be added to /errbot/plugins or you can reconfigure the directory by setting BOT_PLUGIN_DIR
Expand Down
8 changes: 6 additions & 2 deletions docker/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,10 @@
CORE_PLUGINS = (
"ACLs",
"CommandNotFoundFilter",
"VersionChecker",
"Webserver",
"VersionCheck" "Webserver",
)

for env_var, value in os.environ.items():
if env_var.startswith("ERR_APRS_"):
variable_name = env_var[len("ERR_APRS_") :].upper()
exec(f"{variable_name} = '{value}'") # nosec b102 - exec used here intentionally

0 comments on commit 3fe60b8

Please sign in to comment.