Add config.provider module for centralized application configuration#209
Add config.provider module for centralized application configuration#209
Conversation
…v sources, and {{config "key"}} template function
Co-authored-by: intel352 <77607+intel352@users.noreply.github.com>
Co-authored-by: intel352 <77607+intel352@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
This PR introduces a config.provider module type that acts as a centralized configuration registry for workflow engine applications. It addresses the lack of schema declaration, startup validation, defaults, source layering, and sensitive-value distinction in the existing ${ENV_VAR} expansion mechanism. The config.provider module exposes a {{config "key"}} template function for referencing values across any YAML section (modules, workflows, triggers, pipelines, platform), and operates independently of (and alongside) the existing ${ENV_VAR} expansion.
Changes:
- Adds
module/config_provider.go: thread-safeConfigRegistry,ParseSchema,LoadConfigSources,ValidateRequired,ExpandConfigRefsMap, and theConfigProviderModulestruct - Adds
plugins/configprovider/plugin.goand its tests: aConfigTransformHookat priority 1000 that resolves{{config "key"}}references before module construction - Registers
config.provideracross schema, type registry, and the default plugin set
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
module/config_provider.go |
Core implementation: registry, schema parsing, source loading, validation, expansion |
module/config_provider_test.go |
Comprehensive unit tests for all core functions |
plugins/configprovider/plugin.go |
Plugin wiring: module factory + ConfigTransformHook |
plugins/configprovider/plugin_test.go |
Tests for plugin metadata, hook behaviour, expansion |
module/pipeline_template.go |
Adds config function to template func map for runtime use |
schema/schema.go |
Adds "config.provider" to coreModuleTypes |
schema/module_schema.go |
Registers config.provider schema with field definitions |
plugins/all/all.go |
Adds configprovider plugin to the default plugin set |
cmd/wfctl/type_registry.go |
Registers config.provider in the wfctl type registry |
|
@copilot apply changes based on the comments in this thread |
…ix doc comments Co-authored-by: intel352 <77607+intel352@users.noreply.github.com>
module/config_provider.go— ConfigRegistry + ConfigProviderModule + schema/source/expansion utilitiesmodule/config_provider_test.go— unit tests including single-quote regex and sorted missing-keys testsplugins/configprovider/plugin.go— Plugin with ConfigTransformHookplugins/configprovider/plugin_test.go— plugin integration testsplugins/all/all.go,schema/schema.go,schema/module_schema.go,cmd/wfctl/type_registry.go,module/pipeline_template.go{{config 'key'}}/{{config "key"}}ValidateRequiredto sort missing keys for deterministic error messagesInitdoc comment (was incorrectly labelled "Configure")🔒 GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. Learn more about Advanced Security.