Expose require_api_key_origin in frontend settings

This is useful for applications that want to know beforehand if an API
key is necessary before accessing the running instance.
This commit is contained in:
Mufeed Ali 2021-10-30 21:01:50 +05:30
parent 015e77fbf6
commit 915b912c29
No known key found for this signature in database
GPG key ID: 5B93F7B4CC99C769

View file

@ -756,6 +756,9 @@ def create_app(args):
frontendTimeout: frontendTimeout:
type: integer type: integer
description: Frontend translation timeout description: Frontend translation timeout
keyRequired:
type: boolean
description: Whether an API key is required.
suggestions: suggestions:
type: boolean type: boolean
description: Whether submitting suggestions is enabled. description: Whether submitting suggestions is enabled.
@ -790,6 +793,7 @@ def create_app(args):
{ {
"charLimit": args.char_limit, "charLimit": args.char_limit,
"frontendTimeout": args.frontend_timeout, "frontendTimeout": args.frontend_timeout,
"keyRequired": bool(args.api_keys and args.require_api_key_origin),
"suggestions": args.suggestions, "suggestions": args.suggestions,
"filesTranslation": not args.disable_files_translation, "filesTranslation": not args.disable_files_translation,
"supportedFilesFormat": [] if args.disable_files_translation else frontend_argos_supported_files_format, "supportedFilesFormat": [] if args.disable_files_translation else frontend_argos_supported_files_format,