Caddy (Caddy v2.1.3)

View Source

Caddy

Start Caddy HTTP Server in supervisor tree

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_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

Summary

Functions

backup_config()

See Caddy.ConfigProvider.backup_config/0.

child_spec(init_arg)

Returns a specification to start this module under a supervisor.

See Supervisor.

restart_server()

Restart Caddy Server

restore_config()

See Caddy.ConfigProvider.restore_config/0.

set_additional(additionals)

See Caddy.ConfigProvider.set_additional/1.

set_bin(bin_path)

See Caddy.ConfigProvider.set_bin/1.

set_bin!(bin_path)

See Caddy.ConfigProvider.set_bin!/1.

set_global(global)

See Caddy.ConfigProvider.set_global/1.

set_site(name, site)

See Caddy.ConfigProvider.set_site/2.

start()

@spec start() :: :ignore | {:error, any()} | {:ok, pid()}

start(caddy_bin)

@spec start(binary()) :: :ignore | {:error, any()} | {:ok, pid()}

Manually Start Caddy Server.

This is useful when you want to start Caddy Server in iex console.

start_link(args)

@spec start_link(Keyword.t()) :: :ignore | {:error, any()} | {:ok, pid()}

stop(reason \\ :normal)

@spec stop(term()) :: :ok