refactor: autogenerate config stub from lockfile
Description
This helps to simplify adding new configuration keys.
What changed:
- Added
internal/config/gen.go
which is run by go:generate to generateconfig_stub.go
fromconfig.yaml.lock
- Added
internal/config/Readme.md
to document how to add new configs - Added a makefile target
gen-config
to rungen.go
- Renamed
config_type.go
andconfig_type_test.go
toconfig.go
andconfig_test.go
repectively - Modified the tests to use the stub instead of manually adding a full config string
- Added
Test_configLock
which test the generated stub against theconfig.yaml.lock
- Moved
ConfigKeyEquivalence(key string)
,EnvKeyEquivalence(key string)
anddefaultFor(key string)
fromconfig_type.go
to a separateconfig_mapping.go
.
Related Issues
Resolves #1144 (closed)
How has this been tested?
Screenshots (if appropriate):
Types of changes
-
Bug fix (non-breaking change which fixes an issue) -
New feature (non-breaking change which adds functionality) -
Breaking change (fix or feature that would cause existing functionality to change) -
Documentation -
Chore (Related to CI or Packaging to platforms) -
Refactor
Edited by Clement Sam