Add prod_envs option for custom production Mix environments#219
Open
johns10 wants to merge 1 commit intoburrito-elixir:mainfrom
Open
Add prod_envs option for custom production Mix environments#219johns10 wants to merge 1 commit intoburrito-elixir:mainfrom
johns10 wants to merge 1 commit intoburrito-elixir:mainfrom
Conversation
Burrito's is_prod check is hardcoded to `Mix.env() == :prod`, which
fails for projects using custom production environments like :prod_cli
(common when the same codebase produces both a web app and a CLI binary
with different compile-time configs).
Add a `prod_envs` option to the burrito release config that defaults to
`[:prod]` for backward compatibility. Projects with custom envs can pass
their own list:
burrito: [
prod_envs: [:prod, :prod_cli],
targets: [...]
]
Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
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.
Summary
prod_envsoption to the burrito release config that controls which Mix environments are treated as production builds[:prod]for full backward compatibility:prod_cliProblem
is_prod/1inPackAndBuildis hardcoded to checkMix.env() == :prod. Projects that use custom production environments (e.g.:prod_clifor building a CLI binary alongside a web app from the same codebase) always getIS_PROD=0, causing the Zig launcher to skip payload extraction and the release to silently fail to boot.This is common when the same Elixir project needs different compile-time configs for different deployment targets (e.g. SQLite for CLI vs Postgres for web).
Solution
The
prod_envsoption accepts a list of atoms. WhenMix.env()matches any entry,IS_PRODis set to"1". The default[:prod]preserves existing behavior.Test plan
IS_PROD=1in Zig build env withprod_envs: [:prod, :prod_cli]:prodstill works without the option)🤖 Generated with Claude Code