diff --git a/CHANGELOG.md b/CHANGELOG.md
index 31241108..8b15cdb5 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -38,6 +38,7 @@ Section Order:
### Added
- Proper JS settings override
+- Optional settings for Discord Proxy. Comes in handy when used in a Docker environment. (#240)
### Changed
diff --git a/README.md b/README.md
index e75ad2a8..c6030a36 100644
--- a/README.md
+++ b/README.md
@@ -36,6 +36,7 @@ ______________________________________________________________________
- [Step 4: Preload Eve Universe Data](#step-4-preload-eve-universe-data)
- [Step 5: Setting up Permissions](#step-5-setting-up-permissions)
- [Step 6: (Optional) Import From Built-in SRP Module](#step-6-optional-import-from-built-in-srp-module)
+ - [Step 7: (Optional) Settings for Discord Proxy (If Used)](#step-7-optional-settings-for-discord-proxy-if-used)
- [Permissions](#permissions)
- [Changelog](#changelog)
- [Translation Status](#translation-status)
@@ -165,6 +166,15 @@ To import your SRP information from the built-in SRP module, run the following c
python manage.py aasrp_migrate_srp_data
```
+### Step 7: (Optional) Settings for Discord Proxy (If Used)
+
+If you are using [Discord Proxy] to send Discord messages, you can configure the host and port in your `local.py` settings.
+
+| Name | Description | Default |
+| ------------------- | ------------------------------------------------ | ----------- |
+| `DISCORDPROXY_HOST` | Hostname used to communicate with Discord Proxy. | `localhost` |
+| `DISCORDPROXY_PORT` | Port used to communicate with Discord Proxy. | `50051` |
+
## Permissions
| ID | Description | Notes |
diff --git a/aasrp/app_settings.py b/aasrp/app_settings.py
index 384813d0..05ee273b 100644
--- a/aasrp/app_settings.py
+++ b/aasrp/app_settings.py
@@ -4,6 +4,16 @@
# Django
from django.apps import apps
+from django.conf import settings
+
+# Port used to communicate with Discord Proxy
+DISCORDPROXY_PORT = getattr(settings, "DISCORDPROXY_PORT", 50051)
+
+# Host used to communicate with Discord Proxy
+DISCORDPROXY_HOST = getattr(settings, "DISCORDPROXY_HOST", "localhost")
+
+# Timeout for Discord Proxy communication
+DISCORDPROXY_TIMEOUT = getattr(settings, "DISCORDPROXY_TIMEOUT", 300)
def allianceauth_discordbot_installed() -> bool:
diff --git a/aasrp/discord/channel_message.py b/aasrp/discord/channel_message.py
index 713f40c1..27a432c4 100644
--- a/aasrp/discord/channel_message.py
+++ b/aasrp/discord/channel_message.py
@@ -18,7 +18,13 @@
# AA SRP
from aasrp import __title__
-from aasrp.app_settings import allianceauth_discordbot_installed, discordproxy_installed
+from aasrp.app_settings import (
+ DISCORDPROXY_HOST,
+ DISCORDPROXY_PORT,
+ DISCORDPROXY_TIMEOUT,
+ allianceauth_discordbot_installed,
+ discordproxy_installed,
+)
from aasrp.constants import DISCORD_EMBED_COLOR_MAP
logger = LoggerAddTag(get_extension_logger(__name__), __title__)
@@ -106,7 +112,8 @@ def _discordproxy_send_channel_message(
from discordproxy.client import DiscordClient
from discordproxy.exceptions import DiscordProxyException
- client = DiscordClient()
+ target = f"{DISCORDPROXY_HOST}:{DISCORDPROXY_PORT}"
+ client = DiscordClient(target=target, timeout=DISCORDPROXY_TIMEOUT)
try:
logger.debug(msg="Trying to send a channel message via discordproxy")