From 3c91635bc0c3465d456a4a85c8d6c8793df408c2 Mon Sep 17 00:00:00 2001 From: Reillyhewitson Date: Thu, 10 Nov 2022 14:42:48 +0000 Subject: [PATCH] feat: Add warning for no api --- datagateway_api/src/common/config.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/datagateway_api/src/common/config.py b/datagateway_api/src/common/config.py index a23dbb6f..53438fb1 100644 --- a/datagateway_api/src/common/config.py +++ b/datagateway_api/src/common/config.py @@ -189,6 +189,12 @@ def load(cls, path=Path(__file__).parent.parent.parent / "config.json"): try: with open(path, encoding="utf-8") as target: data = json.load(target) + + if "datagateway_api" not in data and "search_api" not in data: + log.warning( + " WARNING: There is no API specified in the configuration file" + ) + return cls(**data) except (IOError, ValidationError) as error: sys.exit(f"An error occurred while trying to load the config data: {error}")