SiteEncrypt.Phoenix (site_encrypt v0.4.2) View Source
SiteEncrypt
adapter for Phoenix endpoints.
Usage
- Add
use SiteEncrypt.Phoenix
to your endpoint immediately afteruse Phoenix.Endpoint
- Configure https via
configure_https/2
. - Add the implementation of
SiteEncrypt.certification/0
to the endpoint (the@behaviour SiteEncrypt
is injected when this module is used).
Link to this section Summary
Functions
Merges paths to key and certificates to the :https
configuration of the endpoint config.
Link to this section Functions
Merges paths to key and certificates to the :https
configuration of the endpoint config.
Invoke this macro from Phoenix.Endpoint.init/2
to complete the https configuration:
defmodule MyEndpoint do
# ...
@impl Phoenix.Endpoint
def init(_key, config) do
# this will merge key, cert, and chain into `:https` configuration from config.exs
{:ok, SiteEncrypt.Phoenix.configure_https(config)}
# to completely configure https from `init/2`, invoke:
# SiteEncrypt.Phoenix.configure_https(config, port: 4001, ...)
end
# ...
end
The options
are any valid adapter HTTPS options. For many great tips on configuring HTTPS for
production refer to the Plug HTTPS guide.