Configuration
Technical reference of Configuración.
This API is used in Configuration.
Symbols
| Symbol | Class | Description |
|---|---|---|
| Config | type | Config defines a public type of API. |
| DevConfig | type | DevConfig defines a public type of API. |
| DevLogsConfig | type | DevLogsConfig defines a public type of API. |
| HTTPConfig | type | HTTPConfig defines a public type of API. |
| TLSConfig | type | HTTPS and certificates configuration. |
| DNSProvider | interface | DNS record provider for ACME. |
| ResolverIPForwardedConfig | type | ResolverIPForwardedConfig defines a public type of API. |
| RoutesConfig | type | RoutesConfig defines a public type of API. |
Config
Declaration:
type Config struct {
ProjectName string
Dev DevConfig
UnmarshalText map[string]func(string) (any, error)
Cluster ClusterAdapter
HTTP HTTPConfig
RateLimit RateLimitConfig
Session SessionConfig
Static StaticConfig
Routes RoutesConfig
WebSocket WebSocketConfig
OnStartServer func() error
OnStopServer func() error
} Config defines a public type of API.
Fields
| Field | Type | Description |
|---|---|---|
ProjectName | string | Name of the element. |
Dev | DevConfig | Public data associated with Dev. |
UnmarshalText | map[string]func(string) (any, error) | Public data associated with UnmarshalText. |
Cluster | ClusterAdapter | Public data associated with Cluster. |
HTTP | HTTPConfig | Public data associated with HTTP. |
RateLimit | RateLimitConfig | Configured limit. |
Session | SessionConfig | Associated session. |
Static | StaticConfig | Public data associated with Static. |
Routes | RoutesConfig | Public data associated with Routes. |
WebSocket | WebSocketConfig | Public data associated with WebSocket. |
OnStartServer | func() error | Public data associated with OnStartServer. |
OnStopServer | func() error | Public data associated with OnStopServer. |
DevConfig
Declaration:
type DevConfig struct {
Enabled bool
Logs DevLogsConfig
} DevConfig defines a public type of API.
Fields
| Field | Type | Description |
|---|---|---|
Enabled | bool | Activate or disable the function. |
Logs | DevLogsConfig | Public data associated with Logs. |
DevLogsConfig
Declaration:
type DevLogsConfig struct {
Static bool
GoxFile bool
Trace bool
TraceDeep bool
} DevLogsConfig defines a public type of API.
Fields
| Field | Type | Description |
|---|---|---|
Static | bool | Public data associated with Static. |
GoxFile | bool | Associated file. |
Trace | bool | Public data associated with Trace. |
TraceDeep | bool | Public data associated with TraceDeep. |
HTTPConfig
Declaration:
type HTTPConfig struct {
TLS TLSConfig
Host string
Port int
MethodsAllowed []string
Compression CompressionConfig
ResolverIPForwarded ResolverIPForwardedConfig
} HTTPConfig defines a public type of API.
Fields
| Field | Type | Description |
|---|---|---|
TLS | TLSConfig | Manual or automatic HTTPS configuration; see HTTP. |
Host | string | Address where the server listens, no port. |
Port | int | HTTP internal port; zero uses 3000. |
MethodsAllowed | []string | Associated method. |
Compression | CompressionConfig | Public data associated with Compression. |
ResolverIPForwarded | ResolverIPForwardedConfig | Public data associated with ResolverIPForwarded. |
TLSConfig
Declaration:
type TLSConfig struct {
Enabled bool
Type string
Port int
Domains []string
Email string
CertFile string
KeyFile string
DNS DNSProvider
RedirectHTTP bool
} | Field | Zero value | Behavior |
|---|---|---|
Enabled | false | TLS disabled; your inactive options are ignored. |
Type | "" | It is equal to car. It supports car, http-01, tls-alpn-01, dns-01 and manual. |
Port | 0 | Internal HTTPS port 443; other than HTTP port. |
Domains | nil | Mandatory in automatic modes. Wildcard requires DNS. |
Email | "" | Optional ACME contact; not supported in manual. |
CertFile | "" | Required PEM string in manual; relative to project or absolute. |
KeyFile | "" | PEM key required in manual. |
DNS | nil | Select DNS-01 in car; mandatory in dns-01 and prohibited in other modes. |
RedirectHTTP | false | If true, redirect by 308 to public HTTPS 443. It does not prevent ACME challenges if it is false. |
See the configuration examples in HTTPS and certificates.
DNSProvider
Declaration:
type DNSProvider interface {
libdns.RecordAppender
libdns.RecordDeleter
} Compatible with libdns v1. The supplier must add and remove the validation TXT records, preserve other records, admit competing challenges and respect the cancellation of the context. A typed but nil supplier is rejected.
ResolverIPForwardedConfig
Declaration:
type ResolverIPForwardedConfig struct {
TrustedProxies []string
Headers []string
RequireTrustedProxy bool
} ResolverIPForwardedConfig defines a public type of API.
Fields
| Field | Type | Description |
|---|---|---|
TrustedProxies | []string | IPs / CIDR of reliable proxies to solve IP and accept X-Forwarded-Proto. |
Headers | []string | IP headers, in order; does not control X-Forwarded-Proto. |
RequireTrustedProxy | bool | It requires applications for application to come from a reliable proxy if true. |
RoutesConfig
Declaration:
type RoutesConfig struct {
Routes map[string]string
} RoutesConfig defines a public type of API.
Fields
| Field | Type | Description |
|---|---|---|
Routes | map[string]string | Public data associated with Routes. |