Documentation ¶
Overview ¶
Package config reads and parses configurations.
Package config reads and parses configurations.
Index ¶
- func Getenv(key string) string
- func ProbeURL(ctx context.Context, url string) bool
- func ReadAndAppendHealthchecksURL(ppfmt pp.PP, key string, field *[]monitor.Monitor) bool
- func ReadAndAppendUptimeKumaURL(ppfmt pp.PP, key string, field *[]monitor.Monitor) bool
- func ReadAuth(ppfmt pp.PP, field *api.Auth) bool
- func ReadBool(ppfmt pp.PP, key string, field *bool) bool
- func ReadCron(ppfmt pp.PP, key string, field *cron.Schedule) bool
- func ReadDomainMap(ppfmt pp.PP, field *map[ipnet.Type][]domain.Domain) bool
- func ReadDomains(ppfmt pp.PP, key string, field *[]domain.Domain) bool
- func ReadEmoji(key string, ppfmt *pp.PP) bool
- func ReadLinuxID(ppfmt pp.PP, key string, field *int) bool
- func ReadNonnegDuration(ppfmt pp.PP, key string, field *time.Duration) bool
- func ReadNonnegInt(ppfmt pp.PP, key string, field *int) bool
- func ReadProvider(ppfmt pp.PP, key, keyDeprecated string, field *provider.Provider) bool
- func ReadProviderMap(ppfmt pp.PP, field *map[ipnet.Type]provider.Provider) bool
- func ReadQuiet(key string, ppfmt *pp.PP) bool
- func ReadString(ppfmt pp.PP, key string, field *string) bool
- func ReadTTL(ppfmt pp.PP, key string, field *api.TTL) bool
- type Config
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ProbeURL ¶ added in v1.9.3
ProbeURL quickly checks whether one can send a HEAD request to the url.
func ReadAndAppendHealthchecksURL ¶ added in v1.9.3
ReadAndAppendHealthchecksURL reads the base URL of a Healthchecks endpoint.
func ReadAndAppendUptimeKumaURL ¶ added in v1.11.0
ReadAndAppendUptimeKumaURL reads the URL of a Push Monitor of an Uptime Kuma server.
func ReadAuth ¶
ReadAuth reads environment variables CF_API_TOKEN, CF_API_TOKEN_FILE, and CF_ACCOUNT_ID and creates an api.CloudflareAuth.
func ReadDomainMap ¶
ReadDomainMap reads environment variables DOMAINS, IP4_DOMAINS, and IP6_DOMAINS and consolidate the domains into a map.
func ReadDomains ¶
ReadDomains reads an environment variable as a comma-separated list of domains.
func ReadLinuxID ¶ added in v1.9.0
ReadLinuxID reads an environment variable as a user or group ID.
func ReadNonnegDuration ¶
ReadNonnegDuration reads an environment variable and parses it as a time duration.
func ReadNonnegInt ¶
ReadNonnegInt reads an environment variable as a non-negative integer.
func ReadProvider ¶ added in v1.5.0
ReadProvider reads an environment variable and parses it as a provider.
policyKey was the name of the deprecated parameters IP4/6_POLICY.
func ReadProviderMap ¶ added in v1.5.0
ReadProviderMap reads the environment variables IP4_PROVIDER and IP6_PROVIDER, with support of deprecated environment variables IP4_POLICY and IP6_POLICY.
func ReadString ¶ added in v1.7.0
ReadString reads an environment variable as a plain string.
func ReadTTL ¶ added in v1.7.2
ReadTTL reads a valid TTL value.
According to API documentation, the valid range is 1 (auto) and [60, 86400]. According to DNS documentation, the valid range is "Auto" and [30, 86400]. We thus accept the union of both ranges---1 (auto) and [30, 86400].
Types ¶
type Config ¶
type Config struct { Auth api.Auth Provider map[ipnet.Type]provider.Provider Use1001 bool Domains map[ipnet.Type][]domain.Domain UpdateCron cron.Schedule UpdateOnStart bool DeleteOnStop bool CacheExpiration time.Duration TTL api.TTL ProxiedTemplate string Proxied map[domain.Domain]bool DetectionTimeout time.Duration UpdateTimeout time.Duration Monitors []monitor.Monitor }
Config holds the configuration of the updater except for the timezone. (The timezone is handled directly by the standard library reading the TZ environment variable.)
func (*Config) NormalizeConfig ¶ added in v1.9.0
NormalizeConfig checks and normalizes the fields [Config.Provider], [Config.Proxied], and [Config.DeleteOnStop]. When any error is reported, the original configuration remain unchanged.
func (*Config) ReadEnv ¶
ReadEnv calls the relevant readers to read all relevant environment variables except TZ and update relevant fields. One should subsequently call Config.NormalizeConfig to maintain invariants across different fields.