#Help using environment variables
1 messages · Page 1 of 1 (latest)
You can press the "Close Post" button above or type /close at any time to close this post.
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!
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
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
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
That would explain that one, but what about the others?
I'm just guessing since I have few specifics and no log showing it happening.
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
!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.
Is it with "_" or "-" when using uppercae?
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
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?
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
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
Kometa is an open-source python project allowing you to unlock the potential of your media server.
that works fine as well.
You are using dashes and I was using underscores
so my settings appear to be correct right?
also, am I accessing the variables correctly?
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
not the plex url, anyway, the rest are redacted.
and how do would you access the variables in the config.yml?
I gave you an example above of how I'm doing it.
yes but I don't know if I should use uppercase or lowercase in the yml files
I'm using lower case and have specified the vars in all manner of case and its worked. It doesn't seem to matter.
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
because kometa is not doing subsitution in the compose file, and the urlencoded values don't belong there anyway.
it works on pic but not in pmm
I just tried
will send the logs
as it still doesn't work
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.
carrot told you it doesn't work. sending the logs when he already told you it doesn't work, is not going to matter
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?
send logs
📝 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> 📝
your token is invalid
you don't need to use it in your run command, because it's already in your config
the env variable I'm using holds the same value I had hardcoded before
then it's not correct
and how was it working before?
like if I just use the value instead of the variable
i'm just telling you what the log shows. the log says the token is invalid
you ask, we tell you and you wanna argue
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?
How are values getting from the env to the docker compose?
Everything's redacted above
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
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.
There's no Plex token in that env file
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
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
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",
yes
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
!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
i don't understand what you're doing here. You are hard-coding three values that you are also setting as secrets.
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
I thought the problem was an invalid token or URL.
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
📝 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> 📝
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'
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 |
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?
📝 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> 📝
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)
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' |
📝 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> 📝
I think that's fixedin 2.0.1
This last error or the one about the env variables?
Also, is that version already out?
Perfect!
What does the error cause?
Also, what I said about the env variables makes sense to you!
?*
I don't understand the question. It causes something to fail, I imagine.
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.
I was asking if you knew what failed
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.
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?
Yes. And I have no issues.
How are you assigning the variable in your config?
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
And you’re just running with docker compose up -d
yes
Try changing the variable name in your config so it doesn’t match exactly what is in your env file
[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
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
sounds like a docker issue