<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    <br>
    <div class="moz-cite-prefix">On 09/07/2018 18:57, Code Wiget wrote:<br>
    </div>
    <blockquote type="cite"
      cite="mid:97239fa3-1e1c-4f6d-899f-f759b7e2964c@Spark">
      <title></title>
      <div name="messageBodySection" style="font-size: 14px;
        font-family: -apple-system, BlinkMacSystemFont, sans-serif;">Hi,
        <div><br>
        </div>
        <div>Say I want to include a function as an environment variable</div>
        <div><br>
        </div>
        <div>I can do this:</div>
        <div> application:set_env(App, Key, NewValue). <br>
        </div>
        <div><br>
        </div>
        <div>Is there any way to do this from a .config file? Such as:</div>
        <div> [{my_app, [ {my_fun, #Fun<my_app.12.39472874>}]}]</div>
        <div><br>
        </div>
        <div>— this gives a compile error. </div>
      </div>
      <br>
    </blockquote>
    <br>
    If you defined a function in the config how would you verify if it's
    correct? You will need to compile it first. In Erlang you can
    compile any arbitrary file directly in your application, see this
    for an example:<br>
<a class="moz-txt-link-freetext" href="https://github.com/yoonka/migresia/blob/master/src/migresia_migrations.erl#L193">https://github.com/yoonka/migresia/blob/master/src/migresia_migrations.erl#L193</a><br>
    <br>
    So, theoretically, you could define a function as a string or binary
    in your config, then in the application write this to a file,
    compile into a binary (i.e. without writing the compiled module to a
    file) and then load directly from that binary and execute. But that
    sounds a bit weird and it's probably not what you need. Maybe you
    can just tell us what are you trying to accomplish?<br>
    <br>
    Best<br>
    Greg<br>
  </body>
</html>