davsclaus opened a new pull request, #29917: URL: https://github.com/apache/camel/pull/29917
Item 2 of [CAMEL-26931](https://issues.apache.org/jira/browse/CAMEL-26931). ## Problem `CommandLineHelper.getUserConfigurationFile` used the local `./camel-cli.properties` when it existed, else the global `~/.camel-cli.properties`, and never merged them. So a project file with one key silently dropped the user's global `repos`, `camel-version` or `runtime`, while `camel config list` showed both files. `camel-jbang-configuration.adoc` ("takes precedence") reads as a merge. Three other places read only the global file: - `PluginHelper`: the repos of a plugin. - `CamelCommand.printConfigurationValues`: the "Running integration with the following configuration" lines. - `CamelJBangMain`: the plugin banner. So they disagreed with the option defaults in the same command. On the launcher from main, with `logging-level=debug` in the global file and `max-seconds=3` in a local file: ``` $ camel run hello.yaml Running integration with the following configuration: --logging-level=info # the global key is listed, but with the value from the local defaults ... # 0 DEBUG lines ``` ## Change - `CommandLineHelper.loadUserConfiguration(printer)` loads the global file and lays the local file over it: a key of the local file wins, and the other global keys stay. A file that cannot be parsed is left out with a warning (once per file, as before), and the other one still applies. Before, a malformed file meant no defaults at all. - The option defaults (`augmentWithUserConfiguration`), `PluginHelper`, `printConfigurationValues` and the plugin banner use it. - `camel config get/set/unset/list` still read and write the one file they act on (`--global`). - `camel-jbang-configuration.adoc` says how the two files combine, and the 4.24 upgrade guide has an entry. After, with the patched jar: ``` $ camel run hello.yaml Running integration with the following configuration: --logging-level=debug --max-seconds=3 ... # 940 DEBUG lines, and the run stops after 3 s ``` ## Tests - `UserConfigurationMergeTest`: the local file is laid over the global one (global-only keys stay, a local key wins); the global file alone; and a local file that cannot be parsed leaves the global one, with the warning. - The config, version set, plugin helper and user config defaults tests pass (38). - End to end with the launcher, as above. - camel-jbang-core: 2998 + 262 tests pass (`DependencyUpdateTest` failed once and passed on the rerun, as on other branches). _Claude Code on behalf of davsclaus_ 🤖 Generated with [Claude Code](https://claude.com/claude-code) -- 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: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
