Skip to content

caddy #

caddy

heroscript

!!caddy.install
    homedir: '/home/user/caddy'
    username: 'admin'
    password: 'secretpassword'
    title: 'Some Title'
    host: 'localhost'
    port: 8888

Constants #

const version = '2.8.4'
const caddy_version = '2.8.4'
const xcaddy_version = '0.4.2'

fn configuration_get #

fn configuration_get() !string

fn configuration_set #

fn configuration_set(args_ ConfigurationArgs) !

fn configure_examples #

fn configure_examples(config WebConfig) !

configure caddy as default webserver & start node, path, domain path e.g. /var/www domain e.g. www.myserver.com

fn get #

fn get(args_ ArgsGet) !&CaddyServer

fn install #

fn install(args_ InstallArgs) !

install caddy will return true if it was already installed

fn install_caddy_from_release #

fn install_caddy_from_release() !

fn install_caddy_with_xcaddy #

fn install_caddy_with_xcaddy(plugins []string) !

fn is_installed #

fn is_installed(version string) !bool

fn play #

fn play(args_ InstallPlayArgs) !

fn plugin_is_installed #

fn plugin_is_installed(plugin_ string) !bool

fn restart #

fn restart(args InstallArgs) !

fn start #

fn start(args_ InstallArgs) !

start caddy

fn stop #

fn stop() !

fn switch #

fn switch(name string)

switch instance to be used for caddy

struct ArgsGet #

@[params]
struct ArgsGet {
pub mut:
	name string = 'default'
}

///////FACTORY

struct CaddyServer #

struct CaddyServer {
pub mut:
	// name is the name of the Caddy server.
	name string = 'default'

	// path is the path to the server's root directory.
	path string = '/var/www'

	// domain is the default domain for the server.
	domain string // sort of default domain

	// plugins is a list of plugins to be used by the server.
	plugins []string
}

CaddyServer represents a Caddy server configuration.

fn (CaddyServer) destroy #

fn (mut self CaddyServer) destroy() !

fn (CaddyServer) install #

fn (mut self CaddyServer) install(args RestartArgs) !

fn (CaddyServer) install_start #

fn (mut self CaddyServer) install_start(args RestartArgs) !

fn (CaddyServer) reload #

fn (mut self CaddyServer) reload() !

load from disk and make sure is properly intialized

fn (CaddyServer) restart #

fn (mut self CaddyServer) restart() !

fn (CaddyServer) running #

fn (mut self CaddyServer) running() !bool

fn (CaddyServer) start #

fn (mut self CaddyServer) start() !

fn (CaddyServer) stop #

fn (mut self CaddyServer) stop() !

struct ConfigurationArgs #

@[params]
struct ConfigurationArgs {
pub mut:
	content string // caddyfile content
	path    string
	restart bool = true
}

struct InstallArgs #

@[params]
struct InstallArgs {
pub mut:
	reset     bool
	start     bool
	restart   bool
	stop      bool
	homedir   string = '/var/www'
	file_path string   // path to caddyfile
	file_url  string   // path to caddyfile
	xcaddy    bool     // wether to install caddy with xcaddy
	plugins   []string // list of plugins to build caddy with
}

struct InstallPlayArgs #

@[params]
struct InstallPlayArgs {
pub mut:
	name       string = 'default'
	heroscript string // if filled in then plbook will be made out of it
	plbook     ?playbook.PlayBook
	reset      bool
	start      bool
	stop       bool
	restart    bool
	delete     bool
	configure  bool // make sure there is at least one installed
}

struct RestartArgs #

@[params]
struct RestartArgs {
pub mut:
	reset bool
}

struct StartArgs #

@[params]
struct StartArgs {
pub mut:
	zinit bool
}

struct WebConfig #

@[params]
struct WebConfig {
pub mut:
	path   string = '/var/www'
	domain string
}