Boerderij / Varken

Standalone application to aggregate data from the Plex ecosystem into InfluxDB using Grafana as a frontend
MIT License
1.16k stars 136 forks source link

[BUG] docker-compose.yml environment variables do not override ini requirements #241

Closed BRTPOB closed 2 years ago

BRTPOB commented 2 years ago

Describe the bug When a user has more than the expected maximum number of services (in my case 3 for Sonarr and Radarr), Varken will throw an exception that the expected section does not exist in the ini file.

To Reproduce Steps to reproduce the behavior:

  1. Edit docker-compose.yml to include 3 of the same service for the *arrs
  2. Pull down Varken
  3. Run Varken

Expected behavior Expected Varken to actually override the requirement of the ini file, since everything has already been configured in the environment variables for Varken.

Environment (please complete the following information):

Additional context

2022-07-17 17:24:33 : DEBUG : iniparser : sonarr:8989 is a valid URL in module [sonarr-1].
2022-07-17 17:24:33 : DEBUG : iniparser : ********n.tld:8989 is a valid URL in module [sonarr-2].
Traceback (most recent call last):
  File "/app/Varken.py", line 92, in <module>
    CONFIG = INIParser(DATA_FOLDER)
  File "/app/varken/iniparser.py", line 29, in __init__
    self.rectify_ini()
  File "/app/varken/iniparser.py", line 138, in rectify_ini
    self.parse_opts()
  File "/app/varken/iniparser.py", line 181, in parse_opts
    url = self.url_check(env.get(f'VRKN_{envsection}_URL', self.config.get(section, 'url')),
  File "/usr/local/lib/python3.9/configparser.py", line 781, in get
    d = self._unify_values(section, vars)
  File "/usr/local/lib/python3.9/configparser.py", line 1149, in _unify_values
    raise NoSectionError(section) from None
configparser.NoSectionError: No section: 'sonarr-3'
samwiseg0 commented 2 years ago

Are you saying that if you set 3 instances in docker and do not set then env then it errors out?

BRTPOB commented 2 years ago

Correct, I set 3 versions of Sonarr and Radarr (VRKN_SONARR_1_URL=sonarr:8989, VRKN_SONARR_2_URL=sonarr4k:18989, VRKN_SONARR_3_URL=sonarrdv:28989) in the docker-compose.yml file for the environment variables, but the ini only had 2 and it threw the error above.

samwiseg0 commented 2 years ago

To be honest. I have no desire to support the docker compose method of configuring any longer. It has not worked well and confuses many. I would suggest moving to just the INI config file as the ENVs will be removed in the future.

BRTPOB commented 2 years ago

That's fine, but the documentation needs to be clear because as of right now it states that you can do either one, and the ENV variables will override the ini, which is why I set it up this way in the first place.

samwiseg0 commented 2 years ago

Removed.