[erlang-questions] Including function in configuration file

Oliver Korpilla oliver.korpilla@REDACTED
Mon Jul 9 22:51:21 CEST 2018


Couldn't you store the code of the compiled module containing the function as binary in an list or binary literal, read it in and call it? 

Oliver 

On July 9, 2018 9:50:14 PM CEST, Roger Lipscombe <roger@REDACTED> wrote:
>On 9 July 2018 at 20:16, Code Wiget <codewiget95@REDACTED> wrote:
>> So, for the ssl options such as:
>> {reuse_session, fun()} {next_protocols_advertised, [binary()]}
>>
>> {user_lookup_fun, {fun(), term()}}, {psk_identity, string()},
>{srp_identity,
>> {string(), string()}}
>>
>> You have to manually set the configuration parameters, and cannot set
>them
>> in a configuration file?
>
>Yes, but you _can_ come up with some other way to specify them in the
>configuration file, and then convert that to an actual function before
>you pass it to SSL options.
>
>We have something like this in our code:
>
>convert_ssl_opt({verify_opts, VerifyOpts}, Acc) ->
>    Opt = {verify_fun, {fun do_verify/3, VerifyOpts}},
>    [Opt | Acc];
>
>...which converts our invented 'verify_opts' into the required
>'verify_fun', by using a do_verify function in the module that does
>the conversion.
>_______________________________________________
>erlang-questions mailing list
>erlang-questions@REDACTED
>http://erlang.org/mailman/listinfo/erlang-questions

-- 
Sent from my Android device with K-9 Mail. Please excuse my brevity.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20180709/7412f27b/attachment.htm>


More information about the erlang-questions mailing list