Hi,

In C5, the configuration lookup is done in the environment variables,
system properties, deployment.yaml file, and the value provided in the
configuration bean class, in that order. However, it looks like environment
variable lookup happens only if the particular configuration is noted to do
so in the deployment.yaml, specifically if the value of the config is
prefixed by a placeholder env:.

gateWayEndpoint: ${env:gateWayEndpoint}

While this pattern may be easy to implement, it is cumbersome to be
followed in a Containerization approach and IMO breaks the 12Factor
approach to configuration. This is because of the need to edit a physical
file in order for the environment variables to be queried. This makes it
harder to maintain a single Container Image for different deployments, and
manipulate the Container runtimes via environment variables.

AFAIU, this pattern emerges from the requirements in SecureVault; having a
${sec:} prefix can mark the configuration value to be resolved through
Secure Vault resolver. However IMO this, value resolution, is not the same
as value lookup.

IMO, the following should be the lookup order, without having to mark a
particular config in the deployment.yaml file.

1. Environment variables: PREFIX_wso2.NAMESPACE_CONFIGKEY="value",
PREFIX_wso2.NAMESPACE_CONFIGPARENT_CONFIG2="value2"
2. deployment.yaml:

wso2.NAMESPACE:

CONFIG_KEY: value

CONFIG_PARENT:

CONFIG2: valu2

3. Default value in the code

This approach would be most Container friendly one as there is no need to
change files depending on deployment patterns, environments, etc.

WDYT?

Regards,
Chamila de Alwis
Committer and PMC Member - Apache Stratos
Senior Software Engineer | WSO2
Blog: https://medium.com/@chamilad
_______________________________________________
Architecture mailing list
[email protected]
https://mail.wso2.org/cgi-bin/mailman/listinfo/architecture

Reply via email to