Feat: Support Explicit File Paths Beyond .env conventions - #17
Merged
Conversation
The replacer already substitutes {TOKEN} in any text file, but the file
handling assumed the ".env.<environment> -> .env" convention: it derived
the output by stripping ".<environment>" and always deleted the template.
That can't fill a file whose environment name sits mid-name, e.g. ASP.NET
Core's appsettings.Production.json, without clobbering appsettings.json.
Add two optional, backward-compatible inputs:
* template-file-path - literal template to read (skips the sibling convention)
* output-file-path - literal output to write; defaults to the template
(fill in place). When distinct from the template the
template is deleted, matching convention-mode behaviour.
environment-name still drives only the <ENV>_<TOKEN>-over-<TOKEN> precedence.
bin/replace reads the new paths from the environment and falls back to the
existing positional / ENV_FILE_PATH behaviour, so current callers and the
`ruby replacer.rb .env staging` CLI are unaffected. Adds tests covering
in-place JSON templating, distinct-output deletion, and env-specific tokens.
Bumps [minitest](https://github.com/minitest/minitest) from 6.0.2 to 6.0.6. - [Changelog](https://github.com/minitest/minitest/blob/master/History.rdoc) - [Commits](minitest/minitest@v6.0.2...v6.0.6) --- updated-dependencies: - dependency-name: minitest dependency-version: 6.0.6 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Bumps [rake](https://github.com/ruby/rake) from 13.3.1 to 13.4.2. - [Release notes](https://github.com/ruby/rake/releases) - [Changelog](https://github.com/ruby/rake/blob/master/History.rdoc) - [Commits](ruby/rake@v13.3.1...v13.4.2) --- updated-dependencies: - dependency-name: rake dependency-version: 13.4.2 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Bumps [standard](https://github.com/standardrb/standard) from 1.36.0 to 1.54.0. - [Release notes](https://github.com/standardrb/standard/releases) - [Changelog](https://github.com/standardrb/standard/blob/main/CHANGELOG.md) - [Commits](standardrb/standard@v1.36.0...v1.54.0) --- updated-dependencies: - dependency-name: standard dependency-version: 1.54.0 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
The replacer already substitutes {TOKEN} in any text file, but the file
handling assumed the ".env.<environment> -> .env" convention: it derived
the output by stripping ".<environment>" and always deleted the template.
That can't fill a file whose environment name sits mid-name, e.g. ASP.NET
Core's appsettings.Production.json, without clobbering appsettings.json.
Add two optional, backward-compatible inputs:
* template-file-path - literal template to read (skips the sibling convention)
* output-file-path - literal output to write; defaults to the template
(fill in place). When distinct from the template the
template is deleted, matching convention-mode behaviour.
environment-name still drives only the <ENV>_<TOKEN>-over-<TOKEN> precedence.
bin/replace reads the new paths from the environment and falls back to the
existing positional / ENV_FILE_PATH behaviour, so current callers and the
`ruby replacer.rb .env staging` CLI are unaffected. Adds tests covering
in-place JSON templating, distinct-output deletion, and env-specific tokens.
…com/bythepixel/env-replacer-action into feat/explicit-template-output-paths
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
ajwilder
approved these changes
Jun 2, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Why