Documentation
¶
Index ¶
- Constants
- func InitCommonConfig(cmd *cli.Command)
- func PluginConfigs(cmd *cli.Command) (map[string]map[string]any, []string)
- func SaveConnection(alias string, server string, token string, cmd *cli.Command) error
- func SetAgentConfig(config *AgentConfig)
- func SetServerConfig(config *ServerConfig)
- type AgentConfig
- type AuditConfig
- type BadgerDBConfig
- type ChatConfig
- type ClusterConfig
- type DockerConfig
- type KVMConfig
- type LogOutputConfig
- type MCPConfig
- type MCPRemoteServerConfig
- type MySQLConfig
- type NomadConfig
- type OriginConfig
- type PodmanConfig
- type PortConfig
- type PostgresConfig
- type RedisConfig
- type ServerAddr
- type ServerConfig
- type TLSConfig
- type TOTPConfig
- type UIConfig
Constants ¶
const CONFIG_DIR = "knot"
const CONFIG_ENV_PREFIX = "KNOT"
const CONFIG_FILE = "knot.toml"
Variables ¶
This section is empty.
Functions ¶
func InitCommonConfig ¶ added in v0.18.0
func PluginConfigs ¶ added in v0.34.0
PluginConfigs extracts the [plugins.<name>] tables from the server's configuration file: each plugin's configuration, delivered to its handlers as request["config"] and validated against the plugin's [tool.knot] config declaration at plugin load.
[plugins] must hold one table per plugin; entries that are not tables are skipped and reported as warnings so a malformed section is visible without stopping the server.
func SaveConnection ¶ added in v0.18.0
func SetAgentConfig ¶ added in v0.18.0
func SetAgentConfig(config *AgentConfig)
SetAgentConfig sets the global agent configuration
func SetServerConfig ¶ added in v0.18.0
func SetServerConfig(config *ServerConfig)
SetServerConfig sets the global server configuration
Types ¶
type AgentConfig ¶ added in v0.18.0
type AgentConfig struct {
Endpoint string
SpaceID string
UpdateAuthorizedKeys bool
ServicePassword string
VSCodeTunnel string
SyslogPort int
APIPort int
DisableTerminal bool
DisableSpaceIO bool
MethodsFile string
DNSResolver bool
// Scriptling plugins to load into space script environments: explicit
// executables (Plugins) and directories to scan (PluginDirs), mirroring
// the scriptling CLI's --plugin / --plugin-dir. Empty by default.
Plugins []string
PluginDirs []string
Port PortConfig
TLS TLSConfig
// Registration handshake: the per-space key proving the agent may
// register for SpaceID, and the pinned fingerprint (sha256 of the
// server certificate's public key) authenticating the agent listener.
// Injected into containers at create time; passed by hand for manual
// agents. Either may be empty for pre-upgrade provisioning.
RegistrationKey string
ServerCertFingerprint string
}
func GetAgentConfig ¶ added in v0.18.0
func GetAgentConfig() *AgentConfig
GetAgentConfig returns the global agent configuration
type AuditConfig ¶ added in v0.18.0
type AuditConfig struct {
Retention int
Routing string // "internal" | "external" | "both"
AuditStream string // stream label for external log driver, defaults to "audit"
// Data-access auditing for environments holding production data copies.
// Both default off — noisy for local development.
FileOperations bool // audit space file read/write/copy operations
SpaceSessions bool // audit interactive session opens (terminal, code-server)
}
type BadgerDBConfig ¶ added in v0.18.0
type ChatConfig ¶ added in v0.19.0
type ChatConfig struct {
Enabled bool
Type string // API protocol of the endpoint at BaseURL: openai, anthropic, google, ollama, xai. Takes precedence over Provider.
Provider string
APIKey string
BaseURL string
OpenAIAPIKey string // Deprecated: use APIKey
OpenAIBaseURL string // Deprecated: use BaseURL
Model string
MaxTokens int
Temperature *float32 // nil leaves the provider's default
SystemPromptFile string
SystemPrompt string
ReasoningEffort string
UIStyle string
}
type ClusterConfig ¶ added in v0.18.0
type ClusterConfig struct {
Key string
AdvertiseAddr string
BindAddr string
Peers []string
AllowLeafNodes bool
Compression bool
TCPOnly bool
// MinClusterSize is the leader-election quorum floor: the fewest nodes
// that must be visible before a zone leader can be elected or kept.
// Set it to the majority of the smallest zone you will run — 2 for
// two- or three-server production zones. The default of 1 suits
// single-machine testing, where a lone server must elect itself.
MinClusterSize int
}
type DockerConfig ¶ added in v0.18.0
type DockerConfig struct {
Host string
}
type KVMConfig ¶ added in v0.35.0
type KVMConfig struct {
// ImagesPath is the directory KVM base images are downloaded into and
// per-space disk overlays + cloud-init seeds live under. It must be
// writable by knot and readable by the qemu user libvirt runs VMs as —
// the libvirt images dir (/var/lib/libvirt/images) is the conventional
// choice when knot runs as root.
ImagesPath string
// CloudImagePath is a read-only library of cloud images admins keep on
// the node. A bare image name in a KVM spec (e.g. "ubuntu-24.04")
// resolves to <CloudImagePath>/<name> (with ".qcow2" appended when the
// name has no extension). Empty follows ImagesPath
// (<ImagesPath>/cloud-images), so relocating the images path moves the
// library too unless this pins it elsewhere.
CloudImagePath string
// BaseImagePath is the cache for base images downloaded from URLs in
// KVM specs: each file lands under it named after the URL's last path
// segment and is reused by every later space on the node. Empty follows
// ImagesPath (<ImagesPath>/base), so relocating the images path moves
// the cache too unless this pins it elsewhere.
BaseImagePath string
// Resolvers are the DNS servers handed to bridged VMs via cloud-init.
// Defaults to Cloudflare's pair; the gateway is no longer injected
// implicitly — admins who want the router to answer DNS list it here.
Resolvers []string
}
type LogOutputConfig ¶ added in v0.24.0
type LogOutputConfig struct {
URL string
Format string
Stream string
Headers map[string]string
Username string // optional HTTP basic auth username
Password string // optional HTTP basic auth password
Token string // optional bearer token (Authorization: Bearer <token>); takes precedence over basic auth
}
type MCPConfig ¶ added in v0.19.0
type MCPConfig struct {
Enabled bool `toml:"enabled"`
RemoteServers []MCPRemoteServerConfig `toml:"remote_servers"`
}
type MCPRemoteServerConfig ¶ added in v0.23.0
type MCPRemoteServerConfig struct {
Namespace string `toml:"namespace"`
URL string `toml:"url"` // HTTP(S) URL of the remote server (empty for stdio)
Command string `toml:"command"` // stdio: executable to launch as a subprocess (empty for HTTP)
Args []string `toml:"args"` // stdio: command-line arguments
Env []string `toml:"env"` // stdio: extra KEY=VALUE environment variables (merged on top of the parent environment)
Token string `toml:"token"` // HTTP bearer token
ToolVisibility string `toml:"tool_visibility"` // "native" or "on-demand"
Notifications bool `toml:"notifications"` // accept listChanged notifications from this server and propagate them
}
type MySQLConfig ¶ added in v0.18.0
type NomadConfig ¶ added in v0.18.0
type OriginConfig ¶ added in v0.18.0
type PodmanConfig ¶ added in v0.18.0
type PodmanConfig struct {
Host string
}
type PortConfig ¶ added in v0.18.0
type PostgresConfig ¶ added in v0.37.0
type RedisConfig ¶ added in v0.18.0
type ServerAddr ¶ added in v0.12.2
func GetServerAddr ¶ added in v0.12.2
func GetServerAddr(alias string, cmd *cli.Command) *ServerAddr
Read the server configuration information and generate the websocket address
func LookupServerAddr ¶ added in v0.34.0
func LookupServerAddr(alias string, cmd *cli.Command) (*ServerAddr, bool)
LookupServerAddr resolves the client.connection.<alias> section of the config file into a ServerAddr. Unlike GetServerAddr it never exits: an invalid or unconfigured alias returns ok=false so callers can fall back to another connection source, e.g. the agentlink socket inside a space.
func NewServerAddr ¶ added in v0.34.0
func NewServerAddr(server, token string) *ServerAddr
NewServerAddr normalises a server URL into a ServerAddr, adding the https scheme when missing, trimming any trailing slash, and deriving the websocket address.
type ServerConfig ¶ added in v0.18.0
type ServerConfig struct {
Listen string
ListenAgent string
URL string
AgentEndpoint string
WildcardDomain string
HTMLPath string
TemplatePath string
AgentPath string
PackagePath string
PrivateFilesPath string
FilesPath string // file storage directory; empty disables file storage
FilesDefaultQuotaMB int // quota for users whose own and group limits are all 0; 0 = unlimited
FilesDefaultMaxBuckets int // bucket limit for users whose own and group limits are all 0; 0 = unlimited
PublicFilesPath string
DownloadPath string
DisableSpaceCreate bool
ListenTunnel string
TunnelDomain string
TunnelServer string
TerminalWebGL bool
EncryptionKey string
Zone string
Hostname string
Timezone string
LeafNode bool
// DesktopMode is set when the server was started by bare `knot`
// (desktop / leaf mode) rather than `knot server`.
DesktopMode bool
// ConfigPath is the config file the server was started from, used by
// the in-server setup wizard to write updates back.
ConfigPath string
AuthIPRateLimiting bool
// Failed-login rate limiting: block auth after AuthRateLimitAttempts
// failures within AuthRateLimitWindow seconds, for AuthRateLimitBlock
// seconds.
AuthRateLimitAttempts int
AuthRateLimitWindow int // seconds
AuthRateLimitBlock int // seconds
DNSEnabled bool
DNSListen string
Nameservers []string
MCPToolTimeout int
ScriptFSAllowedPaths []string
ScriptNetPolicyFile string
Origin OriginConfig
TOTP TOTPConfig
UI UIConfig
Cluster ClusterConfig
MySQL MySQLConfig
Postgres PostgresConfig
BadgerDB BadgerDBConfig
Redis RedisConfig
Audit AuditConfig
LogOutput LogOutputConfig
Docker DockerConfig
Podman PodmanConfig
Nomad NomadConfig
KVM KVMConfig
// EnabledBackends is the admin's platform allowlist: which backends the
// template editor offers and template creation accepts (docker, podman,
// apple, nomad, kvm). Empty means all. Independent of runtime
// detection — a listed backend still needs a node that can run it.
EnabledBackends []string
TLS TLSConfig
MCP MCPConfig
Chat ChatConfig
MCPToolsPath string
MCPToolsDisabled []string
LibDir string
KnotLibPath string
PluginsPath string
BaseImageRegistry string
BaseImagesManifest string
BaseImageRegistryUser string
BaseImageRegistryPassword string
BaseImagesUpdateEnabled bool
BaseImagesUpdateURL string
}
func GetServerConfig ¶ added in v0.18.0
func GetServerConfig() *ServerConfig
GetServerConfig returns the global server configuration
func (*ServerConfig) LegacySessionCookieDomain ¶ added in v0.41.0
func (cfg *ServerConfig) LegacySessionCookieDomain() string
LegacySessionCookieDomain returns the domain earlier versions set on the web session cookie to share it with wildcard subdomains, so a cookie left from then can be deleted. The session cookie is now host-only: wildcard hosts serve users' own code, and web VNC signs in with its own cookie. It is derived from WildcardDomain with any leading "*" (and optional ".") stripped, and is "" when no wildcard domain is configured or the server URL does not live under it.