Skip to content

Commit

Permalink
refactor: make non-mandatory production config options optional
Browse files Browse the repository at this point in the history
  • Loading branch information
Viktor Bozhinov committed Nov 9, 2021
1 parent f64a94c commit 7d68501
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
12 changes: 6 additions & 6 deletions datagateway_api/common/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,16 +140,16 @@ class APIConfig(BaseModel):
"""

datagateway_api: Optional[DatagatewayAPI]
debug_mode: StrictBool
flask_reloader: StrictBool
debug_mode: Optional[StrictBool]
flask_reloader: Optional[StrictBool]
generate_swagger: StrictBool
host: StrictStr
host: Optional[StrictStr]
log_level: StrictStr
log_location: StrictStr
port: StrictStr
port: Optional[StrictStr]
search_api: Optional[SearchAPI]
test_mechanism: StrictStr
test_user_credentials: TestUserCredentials
test_mechanism: Optional[StrictStr]
test_user_credentials: Optional[TestUserCredentials]

@classmethod
def load(cls, path=Path(__file__).parent.parent / "config.json"):
Expand Down
2 changes: 1 addition & 1 deletion test/test_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ def test_load_with_no_config_data(self):
APIConfig.load("test/path")

def test_load_with_missing_mandatory_config_data(self, test_config_data):
del test_config_data["host"]
del test_config_data["log_location"]
with patch("builtins.open", mock_open(read_data=json.dumps(test_config_data))):
with pytest.raises(SystemExit):
APIConfig.load("test/path")
Expand Down

0 comments on commit 7d68501

Please sign in to comment.