From cc2872fc3eca6b5612b925b962f227b3b27ec71f Mon Sep 17 00:00:00 2001 From: Daniil Baturin Date: Mon, 4 Dec 2023 15:48:31 +0000 Subject: https: T5772: require that at least one API key is present --- src/conf_mode/http-api.py | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src/conf_mode/http-api.py') diff --git a/src/conf_mode/http-api.py b/src/conf_mode/http-api.py index 9c062f0aa..c0c16cfc0 100755 --- a/src/conf_mode/http-api.py +++ b/src/conf_mode/http-api.py @@ -59,10 +59,18 @@ def get_config(): key = conf.return_value('keys id {0} key'.format(name)) new_key = { 'id': name, 'key': key } http_api['api_keys'].append(new_key) + else: + raise ConfigError('Missing HTTPS API key string for key id "}"'.format(name)) return http_api def verify(http_api): + # Verify API server settings, if present + keys = http_api['api_keys'] + + if not keys: + raise ConfigError('At least one HTTPS API key is required') + return None def generate(http_api): -- cgit v1.2.3