Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add warning for no api #386

Merged
merged 2 commits into from
Nov 16, 2022
Merged

Conversation

Reillyhewitson
Copy link
Contributor

This PR will close #380

Description

Added a check to the configuration file loading function that outputs a warning if it cannot find a section for datagateway or search api in the config file

Testing Instructions

Add a set up instructions describing how the reviewer should test the code

  • Review code
  • Check GitHub Actions build
  • If icatdb Generator Script Consistency Test CI job fails, is this because of a deliberate change made to the script to change generated data (which isn't actually a problem) or is here an underlying issue with the changes made?
  • Review changes to test coverage
  • Does this change mean a new patch, minor or major version should be made? If so, does one of the commit messages feature fix:, feat: or BREAKING CHANGE: so a release is automatically made via GitHub Actions upon merge?
  • {more steps here}

Agile Board Tracking

Connect to #380

@codecov
Copy link

codecov bot commented Nov 10, 2022

Codecov Report

Base: 94.48% // Head: 94.48% // Increases project coverage by +0.00% 🎉

Coverage data is based on head (7dee9f6) compared to base (40197b2).
Patch coverage: 100.00% of modified lines in pull request are covered.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #386   +/-   ##
=======================================
  Coverage   94.48%   94.48%           
=======================================
  Files          39       39           
  Lines        3116     3118    +2     
  Branches      311      312    +1     
=======================================
+ Hits         2944     2946    +2     
  Misses        144      144           
  Partials       28       28           
Impacted Files Coverage Δ
datagateway_api/src/common/config.py 100.00% <100.00%> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

Copy link
Collaborator

@MRichards99 MRichards99 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you also print the same message please? It's good to have it in the logs, but a developer might be able to resolve an issue more quickly if the message is printed (as well as logged) rather than wondering what's going on, looking in the logs then finally realising their mistake.

@Reillyhewitson
Copy link
Contributor Author

Logging seems to output the message during startup as well. If I add a print statement then I see the message twice. See my console output below

[root@localhost datagateway-api]# poetry run python -m datagateway_api.src.main
   WARNING: There is no API specified in the configuration file
   WARNING: There is no API specified in the configuration file
 * Serving Flask app 'main' (lazy loading)
 * Environment: production
   WARNING: This is a development server. Do not use it in a production deployment.
   Use a production WSGI server instead.
 * Debug mode: off

@MRichards99
Copy link
Collaborator

Ah ok, I didn't notice that! Looks good then, I'll approve

@MRichards99 MRichards99 self-requested a review November 14, 2022 15:36
@Reillyhewitson Reillyhewitson merged commit 962dd80 into main Nov 16, 2022
@Reillyhewitson Reillyhewitson deleted the feature/no-api-warning#380 branch November 16, 2022 09:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Configuration able to be created without datagateway_api or search_api
2 participants