Skip to content

Latest commit

 

History

History
58 lines (37 loc) · 1.26 KB

README.md

File metadata and controls

58 lines (37 loc) · 1.26 KB

Elixir Caddy

release Hex.pm Documentation

Start Caddy reverse proxy server in Elixir project.

Manage caddy configuration in Elixir.

Add this in deps in mix.exs to install

{:caddy, "~> 2.0"}

If caddy bin is set, caddy server will automate start when application start.

Start in extra_applications

def application do
  [
    extra_applications: [Caddy.Application]
  ]
end
  • Notice

If caddy_bin is not specifiy, Caddy.Server will not start.

Set Caddy binary when needed.

Set caddy_bin to the path of Caddy binary file and start Caddy.Server.

Caddy.Cofnig.set_bin("/usr/bin/caddy")
Caddy.restart_server()

This will restart server automatically

Caddy.Cofnig.set_bin!("/usr/bin/caddy")

Config

import Config

# dump caddy server log to stdout
config :caddy, dump_log: false

# caddy server will not start, this is useful for testing
config :caddy, start: false