Lock libretranslate to only users with api keys
-
When tried to setup the keys, as well, I ended up creating four, which is probably fine. But, I ran this command to try to remove the three extra keys for simplicity sake and failed. How do I amend this code to remove keys:
su - cloudron -c 'source /app/code/.venv/bin/activate; ltmanage keys remove <key-I-want-to-remove> --api-keys-db-path /app/data/db/api_keys.db'
The documentation from libretranslate really doesn't help all that much because of how Cloudron interacts with things. Please let me know where I went wrong with my attempt at hacking the code together above because it didn't work.
-
I used this code successfully to show my keys - maybe want to update the docs to show this code as the link to the libretranslate docs shows code that doesn't have the Cloudron layered on:
su - cloudron -c 'source /app/code/.venv/bin/activate; ltmanage keys --api-keys-db-path /app/data/db/api_keys.db'
Also, in the main dashboard of the app, this link is broken (misspelled https://)
-
So, basically, these codes work:
Add a new key:
su - cloudron -c 'source /app/code/.venv/bin/activate; ltmanage keys --api-keys-db-path /app/data/db/api_keys.db add 120'
Show all created keys:
su - cloudron -c 'source /app/code/.venv/bin/activate; ltmanage keys --api-keys-db-path /app/data/db/api_keys.db'But, the remove key doesn't seem to work for me (I don't understand the formatting) and it would be great to have a character set version as well such as from LibreTranslate: ltmanage keys add 120 --char-limit 5000
Okay, sorry for the rapid fire.
-
From the README it seems
Set maximum number of requests per minute per client (outside of limits set by api keys)
so maybe yes. But not really sure. Maybe you can ask upstream about this.Also below
LT_REQUIRE_API_KEY_ORIGIN
is set to true, maybe that means the instance is already locked down to only api keys, but also this is not totally clear to me.