Skip to content

Commit

Permalink
Debug github actions
Browse files Browse the repository at this point in the history
  • Loading branch information
Reillyhewitson committed Sep 22, 2022
1 parent 432b940 commit 7f26f2d
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 9 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/ci-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -299,10 +299,10 @@ jobs:
with:
ref: ${{ github.event.repository.default_branch }}

#- name: Create config.yaml
# run: cp datagateway_api/config.yaml.example datagateway_api/config.yaml
#- name: Create search_api_mapping.json
# run: cp datagateway_api/search_api_mapping.json.example datagateway_api/search_api_mapping.json
- name: Create config.yaml
run: cp datagateway_api/config.yaml.example datagateway_api/config.yaml
- name: Create search_api_mapping.json
run: cp datagateway_api/search_api_mapping.json.example datagateway_api/search_api_mapping.json

# Installing an older version of setuptools for reasons explained at: https://github.com/icatproject/python-icat/issues/99
- name: Uninstall setuptools
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,7 @@ Since adding the search API, the endpoints for each type of API can be configure
`http://localhost:5000/search-api` (assuming default host and port configuration). This
option is made configurable for both DataGateway API and the search API.

In addition to the configuration options in `config.json`, the mappings between the
In addition to the configuration options in `config.yaml`, the mappings between the
PaNOSC and ICAT data models need configuring. An example file exists in
`datagateway_api/` which can be copied from as a starting point. Further explanation of
this file is given [here](#mapping-between-panosc-and-icat-data-models).
Expand Down
5 changes: 3 additions & 2 deletions datagateway_api/src/common/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ def set_backend_type(self, backend_type):
API can detect if the Flask app setup is from an automated test by checking the
app's config for a `TEST_BACKEND`. If this value exists (a KeyError will be
raised when the API is run normally, which will then grab the backend type from
`config.json`), it needs to be set using this function. This is required because
`config.yaml`), it needs to be set using this function. This is required because
creating filters in the `QueryFilterFactory` is backend-specific so the backend
type must be fetched. This must be done using this module (rather than directly
importing and checking the Flask app's config) to avoid circular import issues.
Expand Down Expand Up @@ -176,7 +176,7 @@ class APIConfig(BaseModel):
test_user_credentials: Optional[TestUserCredentials]

@classmethod
def load(cls, path=Path(__file__).parent.parent.parent / "config.yaml"):
def load(cls, path=Path(__file__).parent.parent.parent / "config.yaml.example"):
"""
Loads the config data from the JSON file and returns it as a APIConfig pydantic
model. Exits the application if it fails to locate the JSON config file or
Expand All @@ -189,6 +189,7 @@ def load(cls, path=Path(__file__).parent.parent.parent / "config.yaml"):
try:
with open(path, encoding="utf-8") as target:
data = yaml.safe_load(target)
print(target.read())
return cls(**data)
except (IOError, ValidationError) as error:
sys.exit(f"An error occurred while trying to load the config data: {error}")
Expand Down
2 changes: 1 addition & 1 deletion datagateway_api/src/datagateway_api/backends.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
def create_backend(backend_type):
"""
Create an instance of a backend dependent on the value parsed into the function. The
value will typically be from the contents of `config.json`, however when creating a
value will typically be from the contents of `config.yaml`, however when creating a
backend during automated tests the value will be from the Flask app's config (which
will be set in the API's config at `common.config`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ def get_query_filter(request_filter, entity_name=None):
Given a filter, return a matching Query filter object
The filters are imported inside this method to enable the unit tests to not rely
on the contents of `config.json`. If they're imported at the top of the file,
on the contents of `config.yaml`. If they're imported at the top of the file,
the backend type won't have been updated if the Flask app has been created from
an automated test (file imports occur before `create_api_endpoints()` executes).
Expand Down

0 comments on commit 7f26f2d

Please sign in to comment.