#Environment variables and the config.yaml

1 messages · Page 1 of 1 (latest)

hollow pasture
#

Does the config.yaml support environment variable expansion? Looked through the wiki and didn't find anything. I have KOMETA_PLEX_URL defind in the .env file and would like to not have to have that value set in two places (the .env and the config.yaml) Maybe I missed something somewhere. Tried <<PLEXURL>> in the config, but am getting the following error:

modules.util.Failed: Config Error: url attribute must be set under plex globally or under this specific Library

final prairieBOT
#

Welcome @hollow pasture!

Someone from <@&938443185347244033> will assist when they're available.

Including meta.log from the beginning is a huge help. Type !logs for more information.

After attaching your log, do not forget to hit the green check boxes when prompted by our bot.

#

You can press the "Close Post" button above or type /close at any time to close this post.

dire lake
#

Provide how your attempting the variable in the .env file and inside your config

#

Should be something like
KOMETA_PLEXURL= http://192.168.1.5:32400 (no underscore per instructions)

plex:
  url: <<plexurl>>```
glad cargo
hollow pasture
#

I have this in my .env
KOMETA_PLEXURL=${PLEX_URL}

I have this in my config.yaml

plex:
  url <<PLEXURL>>

If I hard code the values into the config, then I get a timeout error that I'll have to deal with after this.

Reason I'm doing it this way is I have a shared env file that I'm passing into all my media containers via docker compose. I verified that the dot_env call in kometa.py reads it and expands the vars correctly, but can't seem to get the variable expansion to work in the config.

#

This is the full trace

 Traceback (most recent call last):                                                                 |
|   File "/modules/config.py", line 1213, in __init__                                                |
|     "url": check_for_attribute(lib, "url", parent="plex", var_type="url", default=self.general["plex"]["url"], req_default=True, save=False), |
|            ~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
|   File "/modules/config.py", line 456, in check_for_attribute                                      |
|     raise Failed(f"Config Error: {attribute} attribute must be set under {parent} globally or under this specific Library") |
| modules.util.Failed: Config Error: url attribute must be set under plex globally or under this specific Library |
|                                                                                                    |
| Config Error: url attribute must be set under plex globally or under this specific Library         |
glad cargo
#

These are not the same:
docs:

plex:
  url: <<plexurl>>

vs
yours:

plex:
  url <<PLEXURL>>
#

One is uppercase and also missing a colon.

hollow pasture
#

the missing colon was a typo on my part here. Just tried with a lowercase plexurl vs the uppercase with the same result

glad cargo
#

Can you provide a full log?

hollow pasture
#

Is that just the meta.log you want?

glad cargo
#

yes

hollow pasture
final prairieBOT
#

📝 If you want to review this again, punkard:
:one: Right-click (or long press with phone) on the message that contains the log
:two: Select: Copy Message Link
:three: Use the command: /logscan <message_link> or !logscan <message_link> and paste the value copied from the previous step where you see <message_link> 📝

glad cargo
#

These are the variables Kometa is reading:

[DEBUG]    | Kometa Secrets Read:
[DEBUG]    | --kometa-tmdbapikey (KOMETA_TMDBAPIKEY): (redacted)
[DEBUG]    | --kometa-radarrurl (KOMETA_RADARRURL): (redacted)
[DEBUG]    | --kometa-sonarrurl (KOMETA_SONARRURL): (redacted)
[DEBUG]    | --kometa-traktclientid (KOMETA_TRAKTCLIENTID): (redacted)
[DEBUG]    | --kometa-traktclientsecret (KOMETA_TRAKTCLIENTSECRET): (redacted)

Apparently something's different in the way you are defining the Plex URL compared to these, since Kometa doesn't appear to see it.

hollow pasture
#

yeah, I'm looking through kometa.py right now, and if I define my vairable (in the env file) as KOMETA_PLEX_URL, then it sees the value

#

(same with the plex token)

#

but the config file still doesn't resolve it

glad cargo
#

Are all these defined in the same .env and where is it? I'm not sure that the docker container reads the env at runtime.

hollow pasture
#

I'm passing the shared_env using the env_file attr in the compose file. When I exec into the container, I can echo the variables and see the correct values.

#

I also added a print statement in kometa.py to double check, and the values are being loaded correctly.

#

I may just delete everything and start from scratch again.

glad cargo
#

Running outside docker, this just worked fine for me:

#

also worked in docker:

docker run --rm -it -v /home/chaz/kometa/config:/config kometateam/kometa --run --config /config/test-config.yml     
whole streamBOT
#

antwanchild used !aenh

@hollow pasture, anything else needed here? If not, please type /close and hit enter. Please respond within 24 hours of this message or it will be archived.