krot

mongooseim.cfg generator

May 27th, 2020
981
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #!/usr/bin/env escript
  2. %%! -pa _build/default/lib/bbmustache/ebin
  3.  
  4. main([]) ->
  5. OutputFilePath= <<"/etc/mongooseim/mongooseim.cfg">>,
  6. TemplateFile= <<"/root/mongooseimru/rel/files/mongooseim.cfg">>,
  7.   {ok, Template} = file:read_file(TemplateFile),
  8.   {ok, Vars} = file:consult("rel/vars.config"),
  9.     %io:format("~p -- ~p",[Template,Vars])
  10.  
  11.    CfgFile = bbmustache:render(Template, maps:from_list(Vars),
  12.                             [{key_type, atom}]),
  13.         %io:format("~p ",[CfgFile]) .              
  14.                            
  15.  R= file:write_file(OutputFilePath, CfgFile),
  16.  
  17.  io:format("~p ",[R])    
  18.  .
RAW Paste Data