1
0
mirror of https://github.com/LibreTranslate/LibreTranslate.git synced 2024-12-24 10:06:43 +02:00

Expose api_keys in frontend settings

This is useful for applications that want to know beforehand if usage of
an API key is supported.
This commit is contained in:
Mufeed Ali 2021-11-03 20:09:59 +05:30
parent 922ba5de40
commit 2375cea3ca
No known key found for this signature in database
GPG Key ID: 5B93F7B4CC99C769

View File

@ -756,6 +756,9 @@ def create_app(args):
frontendTimeout:
type: integer
description: Frontend translation timeout
apiKeys:
type: boolean
description: Whether the API key database is enabled.
keyRequired:
type: boolean
description: Whether an API key is required.
@ -793,6 +796,7 @@ def create_app(args):
{
"charLimit": args.char_limit,
"frontendTimeout": args.frontend_timeout,
"apiKeys": args.api_keys,
"keyRequired": bool(args.api_keys and args.require_api_key_origin),
"suggestions": args.suggestions,
"filesTranslation": not args.disable_files_translation,