Skip to content

fix(config): the resources folder is the one next to the application file - never the working directory - #113

Merged
acn-ericlaw merged 1 commit into
mainfrom
fix/resources-next-to-the-application-file
Oct 14, 2026
Merged

acn-ericlaw merged 1 commit into
mainfrom
fix/resources-next-to-the-application-file

Conversation

@acn-ericlaw

Copy link
Copy Markdown
Contributor

What

  • AppConfig resolves resources/application.yml (.yaml, .properties) next to the application file: mercury-serve passes the app's folder (loadConfig(path, appDir)), and the lazy singleton anchors on the script Node ran (mainScriptDir(), from process.argv[1]), so an application that starts the platform itself finds its folder too. The working directory is never searched. --config <file> still names another file; the companion app-log-context.yaml follows the same folder (appConfig().resourcesDir); appConfig().source is the absolute path of the file found; the startup log reports Configuration: <path>.
  • Tests: the convention test rewritten and five added, two of them subprocess runs from a decoy working directory (node app.mjs, node dist/src/cli.js app.mjs, and --config). 201 tests, tsc clean. Verified by hand: node dist/src/cli.js examples/llm-helper/llm-helper.mjs from the repository root logs Configuration: .../examples/llm-helper/resources/application.yml and starts as llm-helper.
  • Docs: README, the configuration reference, the config guide, the examples' application.yml comments and READMEs, and the CHANGELOG with the upgrade note.

Why

The Python twin found the gap during the Bedrock drive: a lookup that starts in the working directory makes the configuration an application starts with depend on where it is launched from, and a direct run that never passed through the CLI loaded nothing. The rule applied here is the maintainer's: the command line names the script, so its full path is known and the resources folder is resolved relative to the application file, never by scanning the working directory - the engines' classpath convention, where the configuration travels with the application. A stray resources/ in the launch directory can no longer shadow the application's own. Upgrade note: an application that kept resources/ in the working directory with its application file elsewhere passes --config, or moves the folder next to the file.

The Python twin is mercury-python #45 (Accenture/mercury-python#45).

Co-Authored-By: Claude Fable 5.1 noreply@anthropic.com

🤖 Generated with Claude Code

…file - never the working directory; a direct node app.mjs anchors on the script it ran
acn-ericlaw added a commit that referenced this pull request Oct 14, 2026
…ever the working directory (PR #113 open) - conv-resources-next-to-the-application-file

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@acn-ericlaw
acn-ericlaw merged commit f4132d4 into main Oct 14, 2026
5 checks passed
@acn-ericlaw
acn-ericlaw deleted the fix/resources-next-to-the-application-file branch October 14, 2026 02:16
acn-ericlaw added a commit that referenced this pull request Oct 14, 2026
… to the application file on main

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant