Refactor Configuration Handling and Fix TLS JSON Parsing #74
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 PR introduces a slight refactor of the config file parsing and addresses a bug with TLS configuration parsing from
config.json. It also replaces the fallback toconfig.sample.jsonwith values defined directly in code.defaultConfig()function to define all default configuration values in one place.config.sample.jsonto ensure defaults are always present and defined programmatically.tls_server_nameandinsecure_tls_skip_verifycould only be set via environment variables due to these fields not being exported. As a result, they were not unmarshalled fromconfig.json.clickhouseConfigto exporttls_server_nameandinsecure_tls_skip_verifyfields, enabling proper parsing from JSON configuration files.readEnvBoolwhere invalid environment variable values could overwrite defaults without proper validation. Boolean values are now only updated if they are valid.config_test.goto validate:defaultConfigrather thanconfig.sample.json)config.json, including TLS settings that were previously not parsed.This refactor is fully backward-compatible unless users were relying on the undocumented fallback behavior of
config.sample.json. Such users will now need to either provide a validconfig.jsonfile or rely on the defined defaults.