Skip to content

Declarative metaconfig should be validated against injected config sources #10798

@danielkec

Description

@danielkec

Environment Details

  • Helidon Version: 4
  • Helidon SE

Problem Description

When setting up a config source as a declarative bean its not possible to use metaconfig for it as metaconfig is validated against ConfigSourceProviders only.

So when user wants to configure his custom injected config source custom-example-configsource:

sources:
  - type: "custom-example-configsource"
    properties: 
      test: test

He will endup with:

io.helidon.config.MetaConfigException: Config source of type custom-example-configsource is not supported. Supported types: [file, prefixed, classpath, system-properties, directory, inlined, url, environment-variables]

As metaconfig is created:
https://github.com/helidon-io/helidon/blob/main/config/config/src/main/java/io/helidon/config/ConfigProvider.java#L58

And automatically validated:

    static ConfigSource configSource(String type, Config config) {
        return CONFIG_SOURCE_PROVIDERS.stream()
                .filter(provider -> provider.supports(type))
                .findFirst()
                .map(provider -> provider.create(type, config))
                .orElseThrow(() -> new MetaConfigException("Config source of type " + type + " is not supported."
                                                                        + " Supported types: " + SUPPORTED_CONFIG_SOURCES));
    }

https://github.com/helidon-io/helidon/blob/main/config/config/src/main/java/io/helidon/config/MetaProviders.java#L112

Metadata

Metadata

Assignees

Labels

Type

Projects

Status

Sprint Scope

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions