wangyang0918 commented on a change in pull request #10037: [FLINK-14561] Don't write FLINK_PLUGINS_DIR env variable to Configuration URL: https://github.com/apache/flink/pull/10037#discussion_r340411452
########## File path: flink-core/src/main/java/org/apache/flink/core/plugin/PluginConfig.java ########## @@ -55,23 +55,22 @@ private PluginConfig(Optional<Path> pluginsPath, String[] alwaysParentFirstPatte public static PluginConfig fromConfiguration(Configuration configuration) { return new PluginConfig( - getPluginsDirPath(configuration), + getPluginsDir().map(File::toPath), CoreOptions.getParentFirstLoaderPatterns(configuration)); } - private static Optional<Path> getPluginsDirPath(Configuration configuration) { - String pluginsDir = configuration.getString(ConfigConstants.ENV_FLINK_PLUGINS_DIR, null); - if (pluginsDir == null) { - LOG.info("Environment variable [{}] is not set", ConfigConstants.ENV_FLINK_PLUGINS_DIR); - return Optional.empty(); - } + public static Optional<File> getPluginsDir() { + String pluginsDir = System.getenv().getOrDefault( + ConfigConstants.ENV_FLINK_PLUGINS_DIR, + ConfigConstants.DEFAULT_FLINK_PLUGINS_DIRS); + File pluginsDirFile = new File(pluginsDir); if (!pluginsDirFile.isDirectory()) { LOG.warn("Environment variable [{}] is set to [{}] but the directory doesn't exist", Review comment: If the env is not set and DEFAULT_FLINK_PLUGINS_DIRS does not exist, it will show a confusing log. `Environment variable [FLINK_PLUGINS_DIR] is set to [plugins] but the directory doesn't exist` ---------------------------------------------------------------- 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services