Skip to content

Commit 3fe60b8

Browse files
feat: add additional config to the dockerfile (#71)
This adds to the dockerfile's config to automatically load additional config from the environment
1 parent 3328fb0 commit 3fe60b8

File tree

3 files changed

+10
-3
lines changed

3 files changed

+10
-3
lines changed

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ COPY .github/workflows/constraints.txt /constraints.txt
66
RUN pip install --upgrade --constraint /constraints.txt pip poetry
77
COPY ./ /app
88
WORKDIR /app
9-
RUN poetry build
9+
RUN rm -rf dist && poetry build
1010

1111
from python:3.11-slim
1212
ARG ERRBOT_VERSION=6.2.0

docker/README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@ SUPPRESS_CMD_NOT_FOUND is set to true, this means the bot will just not respond
1717

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

20+
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
21+
the errbot config
22+
2023
## Plugins
2124

2225
Plugins can be added to /errbot/plugins or you can reconfigure the directory by setting BOT_PLUGIN_DIR

docker/config.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,10 @@
5656
CORE_PLUGINS = (
5757
"ACLs",
5858
"CommandNotFoundFilter",
59-
"VersionChecker",
60-
"Webserver",
59+
"VersionCheck" "Webserver",
6160
)
61+
62+
for env_var, value in os.environ.items():
63+
if env_var.startswith("ERR_APRS_"):
64+
variable_name = env_var[len("ERR_APRS_") :].upper()
65+
exec(f"{variable_name} = '{value}'") # nosec b102 - exec used here intentionally

0 commit comments

Comments
 (0)