Sys.config shown as binary terms

Hi Team,

When generating the release for production profile, i did see that sys.config is getting generated as binary terms, it is not a clear text(latin1 encoding).

Please can you let me know, how to resolve this issue

Attached the sys.config generated script

%% coding: utf-8
%% RUNTIME_CONFIG=false
[{exldap,[{settings,[{server,<<[SNIP]>>},{base,<<[SNIP]>>},{port,389},{ssl,false},{user_dn,<<[SNIP]>>},{password,<<[SNIP]>>},{search_timeout,5000}]}]},{phoenix,[{json_library,'Elixir.Jason'}]},{plug_session_mnesia,[{table,session},{max_age,86400},{cleaner_timeout,60}]},{logger,[{console,[{format,<<36,116,105,109,101,32,36,109,101,116,97,100,97,116,97,91,36,108,101,118,101,108,93,32,36,109,101,115,115,97,103,101,10>>},{metadata,[request_id]}]},{level,info}]},{pims,[{ecto_repos,['Elixir.Pims.Repo']},{speech_convertor_exe,<<67,58,47,85,115,101,114,115,47,97,114,97,109,97,100,117,103,47,68,101,115,107,116,111,112,47,69,108,105,120,105,114,47,80,73,77,83,47,112,105,109,115>>},{text_audio_files_path,<<67,58,47,85,115,101,114,115,47,97,114,97,109,97,100,117,103,47,68,101,115,107,116,111,112,47,69,108,105,120,105,114,47,80,73,77,83,47,112,105,109,115,47,102,105,108,101,115>>},{'Elixir.Pims.Repo',[{adapter,'Elixir.Ecto.Adapters.Postgres'},{username,<<[SNIP]>>},{password,<<[SNIP]>>},{database,<<[SNIP]>>},{hostname,<<[SNIP]>>},{after_connect,{'Elixir.Postgrex','query!',[<<83,69,84,32,115,101,97,114,99,104,95,112,97,116,104,32,84,79,32,112,97,99,105,115>>,[]]}},{migration_timestamps,[{type,utc_datetime}]},{url,<<101,99,116,111,58,47,47,112,97,99,105,115,95,112,103,58,112,97,99,105,115,95,112,103,64,108,111,99,97,108,104,111,115,116,47,112,97,99,105,115,95,112,103>>},{pool_size,10}]},{'Elixir.PimsWeb.Endpoint',[{render_errors,[{view,'Elixir.PimsWeb.ErrorView'},{accepts,[<<104,116,109,108>>,<<106,115,111,110>>]}]},{pubsub,[{name,'Elixir.Pims.PubSub'},{adapter,'Elixir.Phoenix.PubSub.PG2'}]},{live_view,[{signing_salt,<<[SNIP]>>}]},{url,[{host,<<101,120,97,109,112,108,101,46,99,111,109>>},{port,80}]},{cache_static_manifest,<<112,114,105,118,47,115,116,97,116,105,99,47,99,97,99,104,101,95,109,97,110,105,102,101,115,116,46,106,115,111,110>>},{http,[{port,4000},{transport_options,[{socket_opts,[inet6]}]}]},{secret_key_base,<<[SNIP]>>},{server,true}]}]}].

Do letme know if anything specific if i have to do

Those are Elixir strings (i.e. UTF-8 encoded binary data) that is formatted there in the binary format. If you copy & paste these values to IEx, you will see that they are strings:

iex(1)> <<105,100,109,103,109,116,46,114,111,99,107,119,101,108,108,99,111,108,108,105,110,115,46,99,111,109>>
"idmgmt.rockwellcollins.com"

Now since you pasted your passwords and secret key data, you should definitely change those. :slight_smile:

If that binary format is wrong or not in that situation, I cannot tell you, because I don’t know what sys.config should contain. But it looks sensible to me.

And is it possible for me to change it?

I have some scripts running in the sys.config after the build that requires these values to be written as strings, not as binaries. Can we do this?

If you need values from sys.config, :file.consult/1 will handle all the details for you.

I tried to do this, but as soon as mix releases generates the files and I try to read it I get this error

iex(11)> :file.consult("sys.config")
{:error, {1, :erl_parse, ['syntax error before: ', '\'-\'']}}

Also, my file starts like this:

%% coding: utf-8
%% RUNTIME_CONFIG=false
[{distillery,[{no_warn_missing,[jsx]}]},{hound,[ ...