Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove useless code #2489

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

remove useless code #2489

wants to merge 2 commits into from

Conversation

DualHappiness
Copy link

The mode automatic mode prod always override by default mode dev, so the code is useless.

@DualHappiness
Copy link
Author

Create a new release with simple rebar.config

{erl_opts, [debug_info]}.
{deps, []}.

{relx, [{release, {rlex_test, "0.1.0"},
         [rlex_test,
          sasl]},

        {mode, dev},

        %% automatically picked up if the files
        %% exist but can be set manually, which
        %% is required if the names aren't exactly
        %% sys.config and vm.args
        {sys_config, "./config/sys.config"},
        {vm_args, "./config/vm.args"}

        %% the .src form of the configuration files do
        %% not require setting RELX_REPLACE_OS_VARS
        %% {sys_config_src, "./config/sys.config.src"},
        %% {vm_args_src, "./config/vm.args.src"}
]}.

{profiles, [{prod, []}]}.

As the document says, When building in the rebar3 prod profile, like with rebar3 as prod release then the relx prod mode is enabled automatically., but the prod mode is added to the most left side of the RelxConfig and because the default relx config is common with a {mode, dev} part, the prod mode will yield.
rebar3 as prod release RelxState is

{state_t,"/home/dual/learn/rlex_test",
         "/home/dual/learn/rlex_test/_build/prod/rel",[],[],#{},
         "/home/dual/learn/rlex_test/config/vm.args",undefined,
         "/home/dual/learn/rlex_test/config/sys.config",undefined,[],[],[],
         keep,
         #{{rlex_test,"0.1.0"} =>
               {release_t,rlex_test,"0.1.0",undefined,
                          [{rlex_test,#{included_applications => undefined,
                                        name => rlex_test,type => undefined,
                                        vsn => undefined}},
                           {sasl,#{included_applications => undefined,
                                   name => sasl,type => undefined,
                                   vsn => undefined}}],
                          false,[],[],undefined,[]}},
         #{},true,false,true,undefined,false,true,true,false,[],true,
         [{profile_string,"prod"}],
         [{base_dir,"/home/dual/learn/rlex_test/_build/prod"}],
         true,[],[],true,undefined,false,dev,true}

The final mode is dev.

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