You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pinot.apache.org by "t0mpere (via GitHub)" <gi...@apache.org> on 2024/02/06 14:38:51 UTC
Re: [PR] Adding support for configuration through environment variables [pinot]
t0mpere commented on code in PR #12307:
URL: https://github.com/apache/pinot/pull/12307#discussion_r1479941077
##########
pinot-spi/src/main/java/org/apache/pinot/spi/env/PinotConfiguration.java:
##########
@@ -201,16 +200,16 @@ private static Configuration loadProperties(String configPath) {
private static Map<String, Object> relaxConfigurationKeys(Configuration configuration) {
return CommonsConfigurationUtils.getKeysStream(configuration).distinct()
- .collect(Collectors.toMap(PinotConfiguration::relaxPropertyName, key -> configuration.getProperty(key)));
+ .collect(Collectors.toMap(PinotConfiguration::relaxPropertyName, configuration::getProperty));
}
private static Map<String, String> relaxEnvironmentVariables(Map<String, String> environmentVariables) {
- return environmentVariables.entrySet().stream().filter(entry -> entry.getKey().startsWith("PINOT_"))
+ return environmentVariables.entrySet().stream().filter(entry -> entry.getKey().startsWith(ENV_PREFIX))
Review Comment:
After catching up, number two was implemented following:
```
export PINOT_CONTROLLER_HOST=host
export PINOT_SERVER_PROPERTY_WHATEVER=whatever_property
export ANOTHER_VARIABLE=random
-------------------- Config from CLI or Config Path ------------------------
dynamic.env.config=pinot.controller.host,pinot.server.property,other.var
pinot.controller.host=PINOT_CONTROLLER_HOST
pinot.server.property=PINOT_SERVER_PROPERTY_WHATEVER
other.var=ANOTHER_VARIABLE
---------------------------------------------------------------------------
config gets templated at runtime with the content of the env vars.
----------------------- final result in memory ----------------------------
dynamic.env.config=pinot.controller.host,pinot.server.property,other.var
pinot.controller.host=host
pinot.server.property=whatever_property
other.var=random
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org