linuxserver / docker-healthchecks

GNU General Public License v3.0
178 stars 38 forks source link

ALLOWED_HOSTS env var is written twice and setting multiple hosts isn't possible #78

Closed pagdot closed 3 years ago

pagdot commented 3 years ago

linuxserver.io

  1. ALLOWED_HOSTS get written twice into the config file!
    1. In 30-config#L17, it is added to the variables which get written to the config file in the for loop
    2. In 30-config#L39, it gets written an additional time encapsulated in "[ ... ]".
  2. Setting additional hosts, as documented doesn't work because the string gets encapsulated in at least "...", preventing interpretation as an array.

Relevant line from docker-compose.yml:

      - ALLOWED_HOSTS=["healthchecks.example.com","healthchecks.example.xyz"]

Relevant parts from generated config:

...
ALLOWED_HOSTS = "["healthchecks.example.com","healthchecks.example.xyz"]"
...
ALLOWED_HOSTS = ["["healthchecks.example.com","healthchecks.example.xyz"]"]
...

Expected Behavior

Generate a valid config

Current Behavior

Invalid config as shown above.

Steps to Reproduce

  1. Set ALLOWED_HOSTS to multiple hostnames. E.g.: ["test.com","test2.com"]
  2. Start container
  3. Watch errors flying by

Environment

OS:Ubuntu 20.04 CPU architecture: x86_64 How docker service was installed: from the official docker repo

Command used to create docker container (run/create/compose/screenshot)

see above :)

Docker logs

healthchecks    | *** Operational MODE: single process ***
healthchecks    | running "exec:/usr/bin/python3 ./manage.py collectstatic --noinput" (pre app)...
healthchecks    | Traceback (most recent call last):
healthchecks    |   File "/app/healthchecks/./manage.py", line 10, in <module>
healthchecks    |     execute_from_command_line(sys.argv)
healthchecks    |   File "/usr/lib/python3.9/site-packages/django/core/management/__init__.py", line 419, in execute_from_command_line
healthchecks    |     utility.execute()
healthchecks    |   File "/usr/lib/python3.9/site-packages/django/core/management/__init__.py", line 363, in execute
healthchecks    |     settings.INSTALLED_APPS
healthchecks    |   File "/usr/lib/python3.9/site-packages/django/conf/__init__.py", line 82, in __getattr__
healthchecks    |     self._setup(name)
healthchecks    |   File "/usr/lib/python3.9/site-packages/django/conf/__init__.py", line 69, in _setup
healthchecks    |     self._wrapped = Settings(settings_module)
healthchecks    |   File "/usr/lib/python3.9/site-packages/django/conf/__init__.py", line 170, in __init__
healthchecks    |     mod = importlib.import_module(self.SETTINGS_MODULE)
healthchecks    |   File "/usr/lib/python3.9/importlib/__init__.py", line 127, in import_module
healthchecks    |     return _bootstrap._gcd_import(name[level:], package, level)
healthchecks    |   File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
healthchecks    |   File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
healthchecks    |   File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
healthchecks    |   File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
healthchecks    |   File "<frozen importlib._bootstrap_external>", line 855, in exec_module
healthchecks    |   File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
healthchecks    |   File "/app/healthchecks/hc/settings.py", line 279, in <module>
healthchecks    |     from .local_settings import *
healthchecks    |   File "/app/healthchecks/hc/local_settings.py", line 4
healthchecks    |     ALLOWED_HOSTS = "["healthchecks.example.com","healthchecks.example.xyz"]""
healthchecks    |                        ^
healthchecks    | SyntaxError: invalid syntax
github-actions[bot] commented 3 years ago

Thanks for opening your first issue here! Be sure to follow the bug or feature issue templates!

pagdot commented 3 years ago

Seems to get fixed in #73

github-actions[bot] commented 3 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

pagdot commented 3 years ago

bump (waitfing for merge of #73)

kaysond commented 3 years ago

fixed @pagdot

pagdot commented 3 years ago

Thanks, forgot that I opened the issue 🙈

Saw it fixed (and appreciate it :) )