Skip to content

Commit

Permalink
feat: Add warning for no api
Browse files Browse the repository at this point in the history
  • Loading branch information
Reillyhewitson committed Nov 10, 2022
1 parent 40197b2 commit 3c91635
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions datagateway_api/src/common/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -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}")
Expand Down

0 comments on commit 3c91635

Please sign in to comment.