Configuration
Table of Contents
Configuration
NOTE: Read this if you want to pass the App name as the second argument to
leptus:start_listener/2.
Leptus configuration file must be named leptus.config and put in priv
directory.
Sections
handlers
Your request handlers should be defined as
{handlers, [{HostMatch, [{module(), State :: any()}]}]}. in leptus.config
options
IP address and port number have default values: 127.0.0.1:8080, but you
can override them as follows:
{options,
[
{ip, inet:ip_address()},
{port, inet:port_number()}
]
}.
Note: For HTTPS you also need to specify cacertfile, certfile
and keyfile:
{options,
[
{cacertfile, file:name()},
{certfile, file:name()},
{keyfile, file:name()}
]
}.
Example
%% leptus.config
{options,
[
{ip, {0, 0, 0, 0}},
{port, 4444},
{cacertfile, "ssl/ca.crt"},
{certfile, "ssl/server.crt"},
{keyfile, "ssl/server.key"}
]
}.
{handlers,
[
{'_',
[{rq_handler1, undefined_state},
{rq_handler2, [admin, dev]}]
}
]
}.