Skip to content

ivanos/erl_cowboy

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Table of Contents

erl_cowboy

erl_cowboy is a thin wrapper around cowboy which makes it easier to share a single cowboy listener port across applications on a single node that want to use cowboy. The wrapper initializes cowboy and dynamically updates cowboy's routing table as applications install their application specific routing tables.

Usage

Add erl_cowboy as a dependency to the application using cowboy. In sys.config for the node, add environment variables for erl_cowboy.

Variable Description
port cowboy listener port for http
listeners number of listeners
app master application that includes erl_cowboy; required when used as dependency
tls_enabled true or false
tls_opts property list with TLS configuration; the options are required when TLS is enabled

See sys.config file for example configuration file.

Applications using cowboy call erl_cowboy:routing/2 with a unique token and the path list part of the routing table. The unique token can be the application name or the name of the module installing the routes. Applications may update their routing in which case the old route entries for the application are replaced with the new ones.

TLS support

When TLS is enabled, its options have to be set in the tls_opts property list:

Variable Description
certfile certificate file name (expected in the priv/erl_cowboy directory of the top-level application)
keyfile key file name (expected in the priv/erl_cowboy directory of the top-level application)
password passphrase to the key; only required if the key is password protected

Sample certificate with the key can be generated by running make tls.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published