@@ -381,6 +381,7 @@ defmodule Mix.Release do
381381
382382 It uses the following release options to customize its behaviour:
383383
384+ * `:reboot_system_after_config`
384385 * `:start_distribution_during_config`
385386 * `:prune_runtime_sys_config_after_boot`
386387
@@ -389,10 +390,12 @@ defmodule Mix.Release do
389390 @ spec make_sys_config ( t , keyword ( ) , Config.Provider . config_path ( ) ) ::
390391 :ok | { :error , String . t ( ) }
391392 def make_sys_config ( release , sys_config , config_provider_path ) do
392- { sys_config , runtime? } = merge_provider_config ( release , sys_config , config_provider_path )
393+ { sys_config , runtime_config? } =
394+ merge_provider_config ( release , sys_config , config_provider_path )
395+
393396 path = Path . join ( release . version_path , "sys.config" )
394397
395- args = [ runtime ?, sys_config ]
398+ args = [ runtime_config ?, sys_config ]
396399 format = "%% coding: utf-8~n%% RUNTIME_CONFIG=~s~n~tw.~n"
397400 File . mkdir_p! ( Path . dirname ( path ) )
398401 File . write! ( path , :io_lib . format ( format , args ) , [ :utf8 ] )
@@ -412,18 +415,27 @@ defmodule Mix.Release do
412415 defp merge_provider_config ( % { config_providers: [ ] } , sys_config , _ ) , do: { sys_config , false }
413416
414417 defp merge_provider_config ( release , sys_config , config_path ) do
415- { extra_config , initial_config } = start_distribution ( release )
418+ { reboot? , extra_config , initial_config } = start_distribution ( release )
416419 prune_after_boot = Keyword . get ( release . options , :prune_runtime_sys_config_after_boot , false )
417- opts = [ extra_config: initial_config , prune_after_boot: prune_after_boot ]
420+
421+ opts = [
422+ extra_config: initial_config ,
423+ prune_after_boot: prune_after_boot ,
424+ reboot_after_config: reboot?
425+ ]
426+
418427 init = Config.Provider . init ( release . config_providers , config_path , opts )
419428 { Config.Reader . merge ( sys_config , [ elixir: [ config_providers: init ] ] ++ extra_config ) , true }
420429 end
421430
422431 defp start_distribution ( % { options: opts } ) do
423- if Keyword . get ( opts , :start_distribution_during_config , false ) do
424- { [ ] , [ ] }
432+ reboot? = Keyword . get ( opts , :reboot_system_after_config , true )
433+ early_distribution? = Keyword . get ( opts , :start_distribution_during_config , false )
434+
435+ if not reboot? or early_distribution? do
436+ { reboot? , [ ] , [ ] }
425437 else
426- { [ kernel: [ start_distribution: false ] ] , [ kernel: [ start_distribution: true ] ] }
438+ { true , [ kernel: [ start_distribution: false ] ] , [ kernel: [ start_distribution: true ] ] }
427439 end
428440 end
429441
0 commit comments