#Help using environment variables

1 messages · Page 1 of 1 (latest)

waxen tartanBOT
#

Welcome @grizzled smelt!

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.

waxen tartanBOT
#

Hey!

I am basically trying to use env variables as described in the docs:
pmm:
<<: [*common-restart-policy]
container_name: pmm
image: kometateam/kometa:latest
user: '${USER_ID}:${GROUP_ID}'
environment:
TZ: ${TIMEZONE}
KOMETA_CONFIG: /config/config.yml
KOMETA_TIMES: 18:00,06:30,16:00
KOMETA_RUN: false
KOMETA_OPERATIONS_ONLY: false
KOMETA_TRACE: false
KOMETA_PLEX_URL: 'http://${SERVER_IP}:32400'
KOMETA_PLEX_TOKEN: (redacted by Luma)
KOMETA_TMDB_API_KEY: (redacted by Luma)
KOMETA_MDB_API_KEY: (redacted by Luma)
volumes:
- ${ROOT_DIR}/${CONFIG_DIR}/pmm:/config
depends_on:
- plex
And then I have an .env file like this:
MDB_API_KEY=some-secret-api-key
TMDB_API_KEY=another-secret-api-key
SERVER_IP=my-local-ip
PLEX_TOKEN=my-plex-token

The problem is that I'm getting errors saying that I am doing something wrong, any clues?

Thanks!

worthy bloom
#

The problem is that I'm getting errors saying that I am doing something wrong, any clues?

Not without more details as to what exactly this means.

#

There's no reason to specify these:

      KOMETA_RUN: false
      KOMETA_OPERATIONS_ONLY: false
      KOMETA_TRACE: false
grizzled smelt
#

it basically says that I'm not passing proper values

#

like the token is invalid

#

or the url is not correct

#

which leads me to think the envs are not being loaded properly

worthy bloom
#

I don't think this is valid:

 KOMETA_PLEX_URL: 'http://%24%7Bserver_ip%7D:32400/'
#

Also no reason to specify this:

      KOMETA_CONFIG: /config/config.yml
grizzled smelt
#

That would explain that one, but what about the others?

worthy bloom
#

I'm just guessing since I have few specifics and no log showing it happening.

grizzled smelt
#

If you give me a few minutes I can provide those

#

However, to get this out of the way

#

Do you see anything else wrong?

#

Especially in the yml config

#

I am using UPPER_CASE for the names

#

and I am using docker compose

worthy bloom
#

!no-redact

What yaml config?

this config:

...
plex:
  url: <<plex_url>>
  token: <<plex_token>>
...
tmdb:                                # REQUIRED for the script to run
  apikey: <<tmdb_key>>
...
mdblist:
  apikey: <<mdb_key>>

And this docker run command:

docker run -it -v "/path/to/config:/config:rw" kometateam/kometa --kometa-plex_url "http://192.168.1.11:32400" --kometa-plex_token "2PxWuxX_XXXXXXXXXXXX" --kometa-tmdb_key "a1ecc47xxxxxxxxxxxxxxxxxxxxxxxxx" --kometa-mdb_key "ub5xixxxxxxxxxxxxxxxxxxxx" --run

Just worked fine for me.

grizzled smelt
#

Is it with "_" or "-" when using uppercae?

worthy bloom
#

This also works

docker run -it -v "/path/to/config:/config:rw" kometateam/kometa --kometa-PLEX_URL "http://192.168.1.11:32400" --kometa-PLEX_TOKEN "2PxWuxX_XXXXXXXXXXXX" --kometa-TMDB_KEY "a1ecc47XXXXXXXXXXXXXXXXXXXXXXXXX" --kometa-MDB_KEY "ub5xiXXXXXXXXXXXXXXXXXXXX" --run
grizzled smelt
#

that is not the same as I am using

#

I am doing KOMETA_MDB_API_KEY whereas you are using kometa-MDB_KEY

#

So that may be the problem?

worthy bloom
#

as does this:

docker run -it -v "/path/to/config:/config:rw" kometateam/kometa --KOMETA-PLEX_URL "http://192.168.1.11:32400" --KOMETA-PLEX_TOKEN "2PxWuxX_XXXXXXXXXXXX" --KOMETA-TMDB_KEY "a1ecc47XXXXXXXXXXXXXXXXXXXXXXXXX" --KOMETA-MDB_KEY "ub5xiXXXXXXXXXXXXXXXXXXXX" --run
grizzled smelt
#

could you try this?

#

docker run -it -v "/path/to/config:/config:rw" kometateam/kometa --KOMETA_PLEX_URL "http://192.168.1.11:32400" --KOMETA_PLEX_TOKEN "2PxWuxX_XXXXXXXXXXXX" --KOMETA_TMDB_KEY "a1ecc47XXXXXXXXXXXXXXXXXXXXXXXXX" --KOMETA_MDB_KEY "ub5xiXXXXXXXXXXXXXXXXXXXX" --run

worthy bloom
#

that works fine as well.

grizzled smelt
#

You are using dashes and I was using underscores

#

so my settings appear to be correct right?

#

also, am I accessing the variables correctly?

worthy bloom
#

env vars work as well:

docker run -it -e KOMETA_PLEX_URL="http://192.168.1.11:32400" -e KOMETA_PLEX_TOKEN "2PxWuxX_XXX" -e KOMETA_TMDB_KEY="a1eccXXX" -e KOMETA_MDB_KEY="ub5xiXXX" -v "/path/to/config:/config:rw" kometateam/kometa --run
worthy bloom
grizzled smelt
#

and how do would you access the variables in the config.yml?

worthy bloom
#

I gave you an example above of how I'm doing it.

grizzled smelt
#

yes but I don't know if I should use uppercase or lowercase in the yml files

worthy bloom
#

I'm using lower case and have specified the vars in all manner of case and its worked. It doesn't seem to matter.

grizzled smelt
#

also why do you say this is invalid?
'http://%24%7Bserver_ip%7D:32400/'

#

KOMETA_PLEX_URL: 'http://${SERVER_IP}:32400'

#

I use that same thing for another thing and it works

worthy bloom
#

because kometa is not doing subsitution in the compose file, and the urlencoded values don't belong there anyway.

grizzled smelt
#

it works on pic but not in pmm

#

I just tried

#

will send the logs

#

as it still doesn't work

worthy bloom
#

Well, not interested in arguing. I've given you several working examples. If you choose to disregard all that and want to argue about some other thing you wish worked without providing any specifics, I'll just bow out.

long grotto
#

carrot told you it doesn't work. sending the logs when he already told you it doesn't work, is not going to matter

grizzled smelt
#

Wait guys, I am no longer talking about the url

#

I accept that, its okay

#

I just sent an example with the token

#

May I send the logs?

long grotto
#

send logs

grizzled smelt
#

Sure

waxen tartanBOT
#

📝 If you want to review this again, rafa130397:
: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> 📝

#
**Kometa Summary Info**

Kometa Section Run Times: Top 10 sections sorted by duration (excluding run times of 0 seconds).

Finished at:20:04:55 2024-05-13 Run Time: 0:00:07 - 0:00:07

long grotto
#

your token is invalid

#

you don't need to use it in your run command, because it's already in your config

grizzled smelt
#

the env variable I'm using holds the same value I had hardcoded before

long grotto
#

then it's not correct

grizzled smelt
#

and how was it working before?

#

like if I just use the value instead of the variable

long grotto
#

i'm just telling you what the log shows. the log says the token is invalid

grizzled smelt
#

everything works fine

#

I understand

#

I will show you another example

long grotto
#

you ask, we tell you and you wanna argue

grizzled smelt
#

I'm sorry if that is what it appears to be the case

#

I apologize

#

I'm just having trouble to understand what's going on

#

I will show you another example

#

to show you that I think none of the variables are being read correctly

#

Is that okay?

worthy bloom
#

How are values getting from the env to the docker compose?

#

Everything's redacted above

grizzled smelt
#

I have an .env file with these values:

#

SERVER_IP=192.168.14.2
MDB_API_KEY=key-here
TMDB_API_KEY=key-here-two

waxen tartanBOT
#

The following was shared by @grizzled smelt and was automatically redacted by Luma as it may have contained sensitive information.

If you feel this message should not have been redacted, resend it with !noredact in your message to avoid redaction.

#

pmm:
<<: [*common-restart-policy]
container_name: pmm
image: kometateam/kometa:latest
user: '${USER_ID}:${GROUP_ID}'
environment:
TZ: ${TIMEZONE}
KOMETA_CONFIG: /config/config.yml
KOMETA_TIMES: 18:00,06:30,20:19
KOMETA_RUN: false
KOMETA_OPERATIONS_ONLY: false
KOMETA_TRACE: false
KOMETA_PLEX_URL: 'http://${SERVER_IP}:32400'
KOMETA_PLEX_TOKEN: (redacted by Luma)
KOMETA_TMDB_API_KEY: (redacted by Luma)
KOMETA_MDB_API_KEY: (redacted by Luma)
volumes:
- ${ROOT_DIR}/${CONFIG_DIR}/pmm:/config
depends_on:
- plex

#

The following was shared by @grizzled smelt and was automatically redacted by Luma as it may have contained sensitive information.

If you feel this message should not have been redacted, resend it with !noredact in your message to avoid redaction.

worthy bloom
#

There's no Plex token in that env file

waxen tartanBOT
#

plex:
url: http://192.168.14.2:32400
token: (redacted by Luma)
timeout: 60
clean_bundles: false
empty_trash: false
optimize: false
db_cache:
verify_ssl:
tmdb:
apikey: (redacted by Luma)
language: en
cache_expiration: 60
region:
mdblist:
apikey: (redacted by Luma)
cache_expiration: 60

grizzled smelt
#

sorry

#

I misset it

#

I have it here

#

PLEX_TOKEN=value-here

#

in the same env file

#

This is from running docker inspect:
"Env": [
"KOMETA_PLEX_TOKEN=my-token-here",
"KOMETA_TRACE=false",
"KOMETA_MDB_API_KEY=value-here",
"KOMETA_CONFIG=/config/config.yml",
"KOMETA_RUN=false",
"KOMETA_TIMES=18:00,06:30,20:19",
"KOMETA_TMDB_API_KEY=value-here",
"KOMETA_OPERATIONS_ONLY=false",
"KOMETA_PLEX_URL=http://192.168.14.2:32400",
"KOMETA_DOCKER=True"
],

#

I see that the env variables are being loaded properly

worthy bloom
#

And what is in your config.yml for those values?

#

I am assuming you have redacted these yourself:

                "KOMETA_PLEX_TOKEN=my-token-here",
                "KOMETA_MDB_API_KEY=value-here",
                "KOMETA_TMDB_API_KEY=value-here",
grizzled smelt
#

yes

waxen tartanBOT
#

The following was shared by @grizzled smelt and was automatically redacted by Luma as it may have contained sensitive information.

If you feel this message should not have been redacted, resend it with !noredact in your message to avoid redaction.

#

plex:
url: http://192.168.14.2:32400
token: (redacted by Luma)
timeout: 60
clean_bundles: false
empty_trash: false
optimize: false
db_cache:
verify_ssl:
tmdb:
apikey: (redacted by Luma)
language: en
cache_expiration: 60
region:
mdblist:
apikey: (redacted by Luma)
cache_expiration: 60

grizzled smelt
#

!noredact
plex:
url: http://192.168.14.2:32400
token: hard-coded-token
timeout: 60
clean_bundles: false
empty_trash: false
optimize: false
db_cache:
verify_ssl:
tmdb:
apikey: <<TMDB_API_KEY>>
language: en
cache_expiration: 60
region:
mdblist:
apikey: hard-coded-api-key
cache_expiration: 60

worthy bloom
#

i don't understand what you're doing here. You are hard-coding three values that you are also setting as secrets.

grizzled smelt
#

let me explain

#

I am trying to show that I think the problem is in how I set the variables in general

#

Since I have problem with any of them

#

That is why I hardocded all the values except one

#

to show you an error

#

so that we don't think the token is invalid or the url is wrong

worthy bloom
#

I thought the problem was an invalid token or URL.

grizzled smelt
#

I think the problem is something else

#

because the hardcoded values for the url or token are the exact same

#

as the ones the env variables hold

#

I don't quite yet understand why the token is invalid or the url is invalid if they work when I copy the values to the yml file

#

I just want to hide a bit my important values in the config.yml file

#

I have some fresh logs

waxen tartanBOT
#

📝 If you want to review this again, rafa130397:
: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> 📝

grizzled smelt
#

This part is weird:

[2024-05-13 20:21:35,033] [overlays.py:597] [DEBUG] | Traceback (most recent call last): |
| File "/modules/overlays.py", line 565, in compile_overlays |
| builder.filter_and_save_items(builder.gather_ids(method, value)) |
| File "/modules/builder.py", line 2306, in filter_and_save_items |
| input_id = int(input_id) |
| ^^^^^^^^^^^^^ |
| TypeError: int() argument must be a string, a bytes-like object or a real number, not 'NoneType' |
| |
[2024-05-13 20:21:35,035] [overlays.py:598] [ERROR] | Unknown Error: int() argument must be a string, a bytes-like object or a real number, not 'NoneType'

worthy bloom
#

The TMDB token is being read just fine:

[2024-05-13 20:19:05,849] [config.py:585]             [INFO]     | Connecting to TMDb...                                                                              |
[2024-05-13 20:19:06,340] [config.py:594]             [INFO]     | TMDb Connection Successful                                                                         |
grizzled smelt
#

and what is that error then?

#

Also:
[2024-05-13 20:19:05,756] [kometa.py:302] [DEBUG] | Kometa Secrets Read: |
[2024-05-13 20:19:05,756] [kometa.py:304] [DEBUG] | --kometa-mdb-api-key (KOMETA_MDB_API_KEY): (redacted) |
[2024-05-13 20:19:05,756] [kometa.py:304] [DEBUG] | --kometa-tmdb-api-key (KOMETA_TMDB_API_KEY): (redacted)

#

It doesn't say anything about the other values

#

Doesn't these lines show that both the url and the token are not being read?

waxen tartanBOT
#

📝 If you want to review this again, rafa130397:
: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> 📝

grizzled smelt
#

So I just grabbed a new token

#

Just to try it out

#

Same error

grizzled smelt
#

I figured it out @long grotto @worthy bloom :
For some reason KOMETA is removing the env variables called KOMETA_PLEX_URL and KOMETA_PLEX_TOKEN. When I use any other names, it works. The values are correct, there are no invalid tokens or invalid urls. Kometa just stripped those two variables, that is why I was getting all of those errors:

[2024-05-13 21:18:11,862] [kometa.py:302] [DEBUG] | Kometa Secrets Read: |
[2024-05-13 21:18:11,863] [kometa.py:304] [DEBUG] | --kometa-tmdb-api-key (KOMETA_TMDB_API_KEY): (redacted) |
[2024-05-13 21:18:11,864] [kometa.py:304] [DEBUG] | --kometa-mdb-api-key (KOMETA_MDB_API_KEY): (redacted) |
[2024-05-13 21:18:11,864] [kometa.py:304] [DEBUG] | --kometa-otra-cosa (KOMETA_OTRA_COSA): (redacted) |
[2024-05-13 21:18:11,865] [kometa.py:304] [DEBUG] | --kometa-algo-raro (KOMETA_ALGO_RARO): (redacted)

#

Now it is working

#

I believe this may be worth mentioning to the dev team since it appears to be a bug

#

What do you guys think?

#

This turned out to be important:

[2024-05-13 20:19:05,756] [kometa.py:302] [DEBUG] | Kometa Secrets Read: |
[2024-05-13 20:19:05,756] [kometa.py:304] [DEBUG] | --kometa-mdb-api-key (KOMETA_MDB_API_KEY): (redacted) |
[2024-05-13 20:19:05,756] [kometa.py:304] [DEBUG] | --kometa-tmdb-api-key (KOMETA_TMDB_API_KEY): (redacted)

grizzled smelt
#

My only question left is this error:
1 | Unknown Error: int() argument must be a string, a bytes-like object or a real number, not 'NoneType' |

waxen tartanBOT
#

📝 If you want to review this again, rafa130397:
: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> 📝

worthy bloom
#

I think that's fixedin 2.0.1

grizzled smelt
#

This last error or the one about the env variables?

#

Also, is that version already out?

worthy bloom
#

The last one

#

And yes, it's out; take a look at the top of the log.

grizzled smelt
#

Perfect!

#

What does the error cause?

#

Also, what I said about the env variables makes sense to you!

#

?*

worthy bloom
#

I wasn't able to reproduce the problem you describe with the env vars as my example above shows.

#

I haven't tried it with docker compose though, so maybe that's the problem case.

grizzled smelt
#

I was asking if you knew what failed

long grotto
#

did you set up the kometa secrets correctly?

#

it still seems like you are hardcoding them in your config and then trying to create environment variables

#

i used secrets via environment variables and have no issues. i can't repro your issue either.

grizzled smelt
#

I used them in fhe same way I set up the other secrets

#

Exactly the same way

#

Just that those two dont get picked up

#

Have you tried reproducing my issue using docker compose?

long grotto
#

Yes. And I have no issues.

grizzled smelt
#

wird

#

I will update

#

and try again

long grotto
#

How are you assigning the variable in your config?

grizzled smelt
#

environment:
- TZ=${TIMEZONE}
- KOMETA_TIMES=18:00,06:30,10:10
- KOMETA_OTRA_COSA=http://${SERVER_IP}:32400
- KOMETA_ALGO_RARO=${PLEX_TOKEN}
- KOMETA_TMDB_API_KEY=${TMDB_API_KEY}
- KOMETA_MDB_API_KEY=${MDB_API_KEY}
- KOMETA_PLEX_URL=http://${SERVER_IP}:32400
- KOMETA_PLEX_TOKEN=${PLEX_TOKEN}

#

this is my docker compose

#

config.yml:
plex:
url: <<PLEX_URL>>
token: <<PLEX_TOKEN>>
timeout: 60
clean_bundles: false
empty_trash: false
optimize: false
db_cache:
verify_ssl:
tmdb:
apikey: <<TMDB_API_KEY>>
language: en
cache_expiration: 60
region:
mdblist:
apikey: <<MDB_API_KEY>>
cache_expiration: 60

#

[2024-05-14 10:10:05,720] [kometa.py:303] [DEBUG] | Kometa Secrets Read: |
[2024-05-14 10:10:05,721] [kometa.py:305] [DEBUG] | --kometa-mdb-api-key (KOMETA_MDB_API_KEY): (redacted) |
[2024-05-14 10:10:05,721] [kometa.py:305] [DEBUG] | --kometa-otra-cosa (KOMETA_OTRA_COSA): (redacted) |
[2024-05-14 10:10:05,721] [kometa.py:305] [DEBUG] | --kometa-algo-raro (KOMETA_ALGO_RARO): (redacted) |
[2024-05-14 10:10:05,721] [kometa.py:305] [DEBUG] | --kometa-tmdb-api-key (KOMETA_TMDB_API_KEY): (redacted)

#

These are the only ones being read

long grotto
#

And you’re just running with docker compose up -d

grizzled smelt
#

yes

long grotto
#

Try changing the variable name in your config so it doesn’t match exactly what is in your env file

grizzled smelt
#

[2024-05-14 10:24:05,545] [kometa.py:303] [DEBUG] | Kometa Secrets Read: |
[2024-05-14 10:24:05,545] [kometa.py:305] [DEBUG] | --kometa-plex-tokenn (KOMETA_PLEX_TOKENN): (redacted) |
[2024-05-14 10:24:05,545] [kometa.py:305] [DEBUG] | --kometa-otra-cosa (KOMETA_OTRA_COSA): (redacted) |
[2024-05-14 10:24:05,545] [kometa.py:305] [DEBUG] | --kometa-algo-raro (KOMETA_ALGO_RARO): (redacted) |
[2024-05-14 10:24:05,545] [kometa.py:305] [DEBUG] | --kometa-tmdb-api-key (KOMETA_TMDB_API_KEY): (redacted) |
[2024-05-14 10:24:05,545] [kometa.py:305] [DEBUG] | --kometa-mdb-api-key (KOMETA_MDB_API_KEY): (redacted) |
[2024-05-14 10:24:05,545] [kometa.py:305] [DEBUG] | --kometa-plex-urll (KOMETA_PLEX_URLL): (redacted)

#

Now it works

long grotto
#

there you go

#

if you are finished here type /close and hit enter

grizzled smelt
#

wait

#

it works just because I changed the name

#

why can't I use the other name?

#

that is the main issue

#

I would like to use the other name or to understand why I can't

long grotto
#

sounds like a docker issue

grizzled smelt
#

okay

#

I can live with that

#

Thanks!