[erlang-questions] Including function in configuration file

Michael Truog mjtruog@REDACTED
Mon Jul 9 21:34:44 CEST 2018


On 07/09/2018 12:16 PM, Code Wiget 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?

I use {Module :: atom(), Function :: atom()} to represent a function for configuration because the arity can be inferred from the configuration value.  I also use {{Module :: atom(), Function :: atom()}} to allow an arity 0 function to return a function, to allow a closure to be used.  The source code I use for this is at https://github.com/CloudI/CloudI/blob/95e76d30ff655562682132f9ec04b07075ce055d/src/lib/cloudi_core/src/cloudi_args_type.erl#L53-L136

Best Regards,
Michael
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20180709/451e96df/attachment.htm>


More information about the erlang-questions mailing list