Caddy.Config (Caddy v2.1.3)

View Source

Configuration structure for Caddy reverse proxy server.

Defines the configuration structure and validation functions for Caddy.

Summary

Functions

Convert caddyfile to JSON

Get backup file path

Get configurable base path for caddy files

Get environment file path

Get etc path for configuration files

Get init configuration file path

Get PID file path

Get configurable priv path

Get run path for runtime files

Get saved JSON configuration file path

Get share path (base path)

Get socket file path

Get tmp path for temporary files

Convert config to caddyfile

Validate Caddy binary path

Validate complete configuration

Validate site configuration format

Get XDG config home path

Get XDG data home path

Types

caddyfile()

@type caddyfile() :: binary()

site_config()

@type site_config() :: caddyfile() | {site_listen(), caddyfile()}

site_listen()

@type site_listen() :: binary()

site_name()

@type site_name() :: binary()

t()

@type t() :: %Caddy.Config{
  additional: [binary()],
  bin: binary() | nil,
  env: [{binary(), binary()}],
  global: binary(),
  sites: map()
}

Functions

adapt(binary, caddy_bin \\ nil)

@spec adapt(caddyfile(), binary() | nil) :: {:ok, map()} | {:error, term()}

Convert caddyfile to JSON

backup_json_file()

@spec backup_json_file() :: Path.t()

Get backup file path

base_path()

Get configurable base path for caddy files

env_file()

Get environment file path

etc_path()

Get etc path for configuration files

init_file()

Get init configuration file path

pid_file()

Get PID file path

priv_path()

Get configurable priv path

run_path()

Get run path for runtime files

saved_json_file()

Get saved JSON configuration file path

set_additional(additionals)

This function is deprecated. user Caddy.set_additional/1 instead.

See Caddy.ConfigProvider.set_additional/1.

set_bin(bin_path)

This function is deprecated. user Caddy.set_bin/1 instead.

See Caddy.ConfigProvider.set_bin/1.

set_bin!(bin_path)

This function is deprecated. user Caddy.set_bin/1 instead.

See Caddy.ConfigProvider.set_bin!/1.

set_global(global)

This function is deprecated. user Caddy.set_global/1 instead.

See Caddy.ConfigProvider.set_global/1.

set_site(name, site)

This function is deprecated. user Caddy.set_site/2 instead.

See Caddy.ConfigProvider.set_site/2.

share_path()

Get share path (base path)

socket_file()

Get socket file path

tmp_path()

Get tmp path for temporary files

to_caddyfile(config)

@spec to_caddyfile(t()) :: caddyfile()

Convert config to caddyfile

user_home()

See System.user_home/0.

validate_bin(caddy_bin)

@spec validate_bin(binary()) :: :ok | {:error, binary()}

Validate Caddy binary path

validate_config(config)

@spec validate_config(t()) :: :ok | {:error, binary()}

Validate complete configuration

validate_site_config(site)

@spec validate_site_config(site_config()) :: :ok | {:error, binary()}

Validate site configuration format

xdg_config_home()

Get XDG config home path

xdg_data_home()

Get XDG data home path