Skip to content

Commit

Permalink
Merge pull request #386 from ral-facilities/feature/no-api-warning#380
Browse files Browse the repository at this point in the history
feat: Add warning for no api
  • Loading branch information
Reillyhewitson authored Nov 16, 2022
2 parents 40197b2 + 7dee9f6 commit 962dd80
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions datagateway_api/src/common/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,13 @@ 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 962dd80

Please sign in to comment.