erlinit icon indicating copy to clipboard operation
erlinit copied to clipboard

Add --vmargs-path option to support custom vm.args file paths

Open Copilot opened this issue 4 months ago • 0 comments

This PR adds a new --vmargs-path option to erlinit that allows users to specify a custom path to the vm.args file. This complements the existing --boot option and provides flexibility for deployments that need to use vm.args files in non-standard locations.

Changes

  • Added --vmargs-path command-line option that accepts a path to a vm.args file
  • Supports both absolute paths (e.g., /data/vm.args) and relative paths (e.g., custom.vm.args relative to the release version directory)
  • If the specified file exists, erlinit uses it
  • If the specified file doesn't exist, erlinit prints a warning and falls back to the default vm.args location in the release version directory

Implementation

The implementation follows the same pattern as the existing --boot option for consistency:

  1. Check if user specified a custom vmargs path
  2. Resolve absolute vs relative paths
  3. Verify the file exists
  4. Fall back to default location if not found, with a warning

Example Usage

In erlinit.config:

--vmargs-path
/data/custom.vm.args

Or on the command line:

erlinit --vmargs-path custom.vm.args

Testing

Added three comprehensive test cases:

  • 068_vmargs_path: Verifies a valid custom vm.args path (relative) works correctly
  • 069_vmargs_path_missing: Verifies fallback behavior when specified file doesn't exist
  • 070_vmargs_path_absolute: Verifies absolute path support

All 70 tests pass successfully.

Fixes #[issue_number]

Original prompt

This section details on the original issue you should resolve

<issue_title>Add an erlinit.conf option to support passing a path for the vm.args</issue_title> <issue_description>When the option is passed, erlinit should check that the file exists. If it does, it should use it. If it doesn't, it should print a warning and find the OTP release's vm.args instead.</issue_description>

Comments on the Issue (you are @copilot in this section)

Fixes nerves-project/erlinit#130

💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot avatar Oct 08 '25 20:10 Copilot