Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func PageHandler ¶ added in v0.33.0
func PageHandler(o Options) http.HandlerFunc
PageHandler returns a handler that renders the wizard page, building the form from the config file at request time (so re-runs reflect the current file). Intended for embedding in a running server behind its own auth.
func PreviewHandler ¶ added in v0.33.0
func PreviewHandler(o Options) http.HandlerFunc
PreviewHandler returns a handler that merges the submitted TOML with the existing config without writing anything, so the wizard's review step can show the true final file — including sections the wizard doesn't manage.
func SaveHandler ¶ added in v0.33.0
func SaveHandler(o Options) http.HandlerFunc
SaveHandler returns a handler that validates and writes the submitted config to the target path. Intended for embedding in a running server behind its own auth; it does not stop anything.
func StaticHandler ¶ added in v0.33.0
StaticHandler returns a handler serving the wizard's embedded static assets; the mount prefix is stripped from the request path.
Types ¶
type Form ¶
type Form struct {
// Deployment selects the step-1 preset card; empty means none selected.
// "desktop" is the local-machine preset used by desktop mode.
Deployment string `json:"deployment" msgpack:"deployment"`
Listen string `json:"listen" msgpack:"listen"`
ListenAgent string `json:"listen_agent" msgpack:"listen_agent"`
URL string `json:"url" msgpack:"url"`
AgentEndpoint string `json:"agent_endpoint" msgpack:"agent_endpoint"`
WildcardDomain string `json:"wildcard_domain" msgpack:"wildcard_domain"`
Timezone string `json:"timezone" msgpack:"timezone"`
NomadAddr string `json:"nomad_addr" msgpack:"nomad_addr"`
NomadToken string `json:"nomad_token" msgpack:"nomad_token"`
NomadDC string `json:"nomad_dc" msgpack:"nomad_dc"`
NomadRegion string `json:"nomad_region" msgpack:"nomad_region"`
DockerHost string `json:"docker_host" msgpack:"docker_host"`
PodmanHost string `json:"podman_host" msgpack:"podman_host"`
DBType string `json:"db_type" msgpack:"db_type"`
SessionRedis bool `json:"session_redis" msgpack:"session_redis"`
Nameservers string `json:"nameservers" msgpack:"nameservers"`
MySQLHost string `json:"mysql_host" msgpack:"mysql_host"`
MySQLPort int `json:"mysql_port" msgpack:"mysql_port"`
MySQLUser string `json:"mysql_user" msgpack:"mysql_user"`
MySQLPassword string `json:"mysql_password" msgpack:"mysql_password"`
MySQLDatabase string `json:"mysql_database" msgpack:"mysql_database"`
PostgresHost string `json:"postgres_host" msgpack:"postgres_host"`
PostgresPort int `json:"postgres_port" msgpack:"postgres_port"`
PostgresUser string `json:"postgres_user" msgpack:"postgres_user"`
PostgresPassword string `json:"postgres_password" msgpack:"postgres_password"`
PostgresDatabase string `json:"postgres_database" msgpack:"postgres_database"`
RedisHosts []string `json:"redis_hosts" msgpack:"redis_hosts"`
RedisPassword string `json:"redis_password" msgpack:"redis_password"`
BadgerPath string `json:"badger_path" msgpack:"badger_path"`
EncryptionKey string `json:"encryption_key" msgpack:"encryption_key"`
EnableMCP bool `json:"enable_mcp" msgpack:"enable_mcp"`
DNSEnabled bool `json:"dns_enabled" msgpack:"dns_enabled"`
DNSListen string `json:"dns_listen" msgpack:"dns_listen"`
DNSRecords []string `json:"dns_records" msgpack:"dns_records"`
ChatEnabled bool `json:"chat_enabled" msgpack:"chat_enabled"`
ChatType string `json:"chat_type" msgpack:"chat_type"`
ChatAPIKey string `json:"chat_api_key" msgpack:"chat_api_key"`
ChatBaseURL string `json:"chat_base_url" msgpack:"chat_base_url"`
ChatModel string `json:"chat_model" msgpack:"chat_model"`
TunnelEnabled bool `json:"tunnel_enabled" msgpack:"tunnel_enabled"`
TunnelListen string `json:"tunnel_listen" msgpack:"tunnel_listen"`
TunnelDomain string `json:"tunnel_domain" msgpack:"tunnel_domain"`
TunnelServer string `json:"tunnel_server" msgpack:"tunnel_server"`
TotpEnabled bool `json:"totp_enabled" msgpack:"totp_enabled"`
TotpIssuer string `json:"totp_issuer" msgpack:"totp_issuer"`
AuthIPRateLimiting bool `json:"auth_ip_rate_limiting" msgpack:"auth_ip_rate_limiting"`
AuthRateLimitAttempts int `json:"auth_rate_limit_attempts" msgpack:"auth_rate_limit_attempts"`
AuthRateLimitWindow int `json:"auth_rate_limit_window" msgpack:"auth_rate_limit_window"`
AuthRateLimitBlock int `json:"auth_rate_limit_block" msgpack:"auth_rate_limit_block"`
ClusterAdvertiseAddr string `json:"cluster_advertise_addr" msgpack:"cluster_advertise_addr"`
ClusterKey string `json:"cluster_key" msgpack:"cluster_key"`
ClusterPeers string `json:"cluster_peers" msgpack:"cluster_peers"`
AllowLeafNodes bool `json:"allow_leaf_nodes" msgpack:"allow_leaf_nodes"`
EnableGravatar bool `json:"enable_gravatar" msgpack:"enable_gravatar"`
LogOutputEnabled bool `json:"log_output_enabled" msgpack:"log_output_enabled"`
LogOutputURL string `json:"log_output_url" msgpack:"log_output_url"`
LogOutputFormat string `json:"log_output_format" msgpack:"log_output_format"`
LogOutputToken string `json:"log_output_token" msgpack:"log_output_token"`
LogOutputUsername string `json:"log_output_username" msgpack:"log_output_username"`
LogOutputPassword string `json:"log_output_password" msgpack:"log_output_password"`
AuditRouting string `json:"audit_routing" msgpack:"audit_routing"`
AuditRetention int `json:"audit_retention" msgpack:"audit_retention"`
AuditFileOps bool `json:"audit_file_operations" msgpack:"audit_file_operations"`
AuditSessions bool `json:"audit_space_sessions" msgpack:"audit_space_sessions"`
}
func DefaultForm ¶
func DefaultForm() Form
func DesktopForm ¶ added in v0.33.0
func DesktopForm() Form
DesktopForm returns the local-machine preset used when desktop mode launches the wizard: embedded storage under ~/.knot, loopback listeners, a container-reachable agent endpoint template, and the built-in DNS server answering on knot.internal so local clients resolve space addresses without external DNS.
func FormFromConfig ¶ added in v0.33.0
FormFromConfig overlays an existing knot.toml onto a base form. Missing keys keep the base values.
type Options ¶ added in v0.33.0
type Options struct {
// TargetPath forces the output path instead of resolving via the
// config search paths. Used by desktop mode (~/.knot/knot.toml).
TargetPath string
// AllowOverwrite permits saving when the target file already exists.
// Used by desktop mode, which pre-fills the wizard from the existing
// (incomplete) config and completes it.
AllowOverwrite bool
// Desktop selects the local-machine preset and desktop success
// messaging (restart the app rather than run knot server).
Desktop bool
// AuditConfigWrites emits a Config Update audit event when the wizard
// saves. Set for the in-server /setup mount, where config changes happen
// at runtime; the standalone pre-config wizard has no audit trail yet.
AuditConfigWrites bool
// BasePath is the URL prefix the wizard is served under ("/" for the
// standalone server, "/setup/" when embedded in a running server).
BasePath string
}
Options tunes wizard behaviour. The zero value matches the historical `knot server config-wizard` behaviour.