title: Running An Erlang Escript File With SSL Distribution
body: <p>I have a little escript file that connects to a node and does some rpc calls and stuff...</p>
  
  <p>It works fine for short or longnames but relies on standard http comms for distributed Erlang.</p>
  
  <p>I would like to use it but with https/SSL for distribution.</p>
  
  <p>To start a 'normal' Erlang system with SSL you have to pass in the various flags to tell Erlang to run that way, as the <a href="http://erlang.org/doc/apps/ssl/ssl_distribution.html" rel="nofollow noreferrer">documentation</a> suggests:</p>
  
  <pre><code>$ ERL_FLAGS="-boot \"/home/me/ssl/start_ssl\" -proto_dist inet_ssl 
    -ssl_dist_opt client_certfile \"/home/me/ssl/erlclient.pem\" 
    -ssl_dist_opt server_certfile \"/home/me/ssl/erlserver.pem\" 
    -ssl_dist_opt verify 1 -ssl_dist_opt depth 1"
  $ export ERL_FLAGS
  $ erl -sname ssl_test
  </code></pre>
  
  <p>This replaces the default distribution mechanism (<code>inet_tcp_dist</code>) with the ssl one (<code>inet_ssl_dist</code>).</p>
  
  <p><a href="http://erlang.org/doc/man/escript.html" rel="nofollow noreferrer">escript</a> runs an erlang file as a shell scripting file.</p>
  
  <p>My questions are:</p>
  
  <ul>
  <li>is it possible to get the Erlang 'environment' in which escript runs to use the secure distribution mechanism instead of the default one?</li>
  <li>and if so, how would I do it?</li>
  </ul>