[erlang-questions] cowboy options via application config

22 views
Skip to first unread message

Joel Reymont

unread,
Dec 1, 2011, 10:07:23 AM12/1/11
to Erlang Questions
Is there a way to pass options to cowboy listeners via the application's config file, e.g. rebar's sys.config?

In the code below, I'd rather have the transport, port, key file and password in a config file.

Thanks, Joel

---

cowboy:start_listener(http, 100,
cowboy_tcp_transport, [{port, 8080}],
cowboy_http_protocol, [{dispatch, Dispatch}]
),
cowboy:start_listener(https, 100,
cowboy_ssl_transport, [
{port, 8443}, {certfile, "priv/ssl/cert.pem"},
{keyfile, "priv/ssl/key.pem"}, {password, "cowboy"}],
cowboy_http_protocol, [{dispatch, Dispatch}]
),

--------------------------------------------------------------------------
- for hire: mac osx device driver ninja, kernel extensions and usb drivers
---------------------+------------+---------------------------------------
http://wagerlabs.com | @wagerlabs | http://www.linkedin.com/in/joelreymont
---------------------+------------+---------------------------------------

_______________________________________________
erlang-questions mailing list
erlang-q...@erlang.org
http://erlang.org/mailman/listinfo/erlang-questions

Bob Ippolito

unread,
Dec 1, 2011, 11:03:11 AM12/1/11
to Joel Reymont, Erlang Questions
You could just call the appropriate application module functions to get the data from keys in your app's config.

Joel Reymont

unread,
Dec 1, 2011, 11:19:32 AM12/1/11
to Bob Ippolito, Erlang Questions
That's what I ended up doing, thanks!

On Dec 1, 2011, at 4:03 PM, Bob Ippolito wrote:

> You could just call the appropriate application module functions to get the data from keys in your app's config.

--------------------------------------------------------------------------

Reply all
Reply to author
Forward
0 new messages