Add support for custom configuration file path in TemplateServer #5
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This pull request refactors the configuration loading mechanism in
TemplateServerto improve flexibility and clarity. The main change is that the server now accepts a full configuration file path, rather than just a filename, which enhances configurability and testability. Related tests have been updated to reflect this new behavior.Configuration loading improvements:
TemplateServerconstructor now takes aconfig_filepathparameter (defaulting toCONFIG_DIR / CONFIG_FILE_NAME) instead of just a filename, allowing users to specify the full path to the configuration file. (python_template_server/template_server.py)load_configmethod now requires aPathobject for the configuration file path, and all references within the method have been updated to use this parameter, improving clarity and error messaging. (python_template_server/template_server.py)TemplateServer.__init__now callsload_config(config_filepath)instead ofload_config(), ensuring the correct path is used. (python_template_server/template_server.py)Testing updates:
load_configis called with the specified file path and that the configuration is loaded as expected. (tests/test_template_server.py)Pathfor consistency with the new parameter type. (tests/test_template_server.py)