<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
</head>
<body>
<div name="messageBodySection" style="font-size: 14px; font-family: -apple-system, BlinkMacSystemFont, sans-serif;">
<div style="orphans: 2; widows: 2;">So, for the ssl options such as:<br />
{reuse_session, fun()} {next_protocols_advertised, [binary()]}<br />
<br />
{user_lookup_fun, {fun(), term()}}, {psk_identity, string()}, {srp_identity, {string(), string()}}<br />
<br />
You have to manually set the configuration parameters, and cannot set them in a configuration file?<br />
<br /></div>
</div>
<div name="messageReplySection" style="font-size: 14px; font-family: -apple-system, BlinkMacSystemFont, sans-serif;"><br />
On Jul 9, 2018, 3:15 PM -0400, Roger Lipscombe <roger@differentpla.net>, wrote:<br />
<blockquote type="cite" style="margin: 5px 5px; padding-left: 10px; border-left: thin solid #1abc9c;">No. The '#Fun<stuff>' isn't really a thing; it's just how the function<br />
is printed in the shell.<br />
<br />
If you want to reference a function in a config file, it needs to be a<br />
real function, and you need to reference it by name. If you don't know<br />
which module it's implemented in, you'll need to specify that in your<br />
config file as well. Something like this:<br />
<br />
[<br />
{my_app,<br />
[<br />
{my_magic_func, {the_module, func_name}}<br />
]}<br />
].<br />
<br />
Then, in your code that reads the configuration value, you need to<br />
explicitly invoke the function with erlang:apply...<br />
<br />
{ok, {Module, Func}} = application:get_env(my_app, my_magic_func),<br />
erlang:apply(Module, Func, [Arg1, Arg2]) % calls<br />
the_module:func_name(Arg1, Arg2)<br />
<br />
<br />
<br />
On 9 July 2018 at 19:57, Code Wiget <codewiget95@gmail.com> wrote:<br />
<blockquote type="cite" style="margin: 5px 5px; padding-left: 10px; border-left: thin solid #e67e22;">Hi,<br />
<br />
Say I want to include a function as an environment variable<br />
<br />
I can do this:<br />
 application:set_env(App, Key, NewValue).<br />
<br />
Is there any way to do this from a .config file? Such as:<br />
 [{my_app, [ {my_fun, #Fun<my_app.12.39472874>}]}]<br />
<br />
— this gives a compile error.<br />
<br />
_______________________________________________<br />
erlang-questions mailing list<br />
erlang-questions@erlang.org<br />
http://erlang.org/mailman/listinfo/erlang-questions<br />
<br /></blockquote>
</blockquote>
<div></div>
</div>
</body>
</html>