From 2375cea3cad71c87c05b035c09c4f96b3b0bd1a4 Mon Sep 17 00:00:00 2001
From: Mufeed Ali <fushinari@protonmail.com>
Date: Wed, 3 Nov 2021 20:09:59 +0530
Subject: [PATCH] Expose api_keys in frontend settings

This is useful for applications that want to know beforehand if usage of
an API key is supported.
---
 app/app.py | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/app/app.py b/app/app.py
index edc45dd..bbc2690 100644
--- a/app/app.py
+++ b/app/app.py
@@ -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,
-- 
GitLab