Documentation
¶
Index ¶
Constants ¶
const ( DefaultExecutorTimeout = 60 DefaultLogLevel = "info" DefaultVersion = "unknown" )
Documented defaults for keys the configuration file may omit.
const ( MinExecutorTimeout = 1 MaxExecutorTimeout = 300 )
Documented bounds for the negotiated control lease, in seconds.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CORSConfig ¶
type CORSConfig struct {
// AllowedOrigins is the list of origins allowed to make credentialed
// (cookie-based) requests to the API. Cookie auth (session_token) only
// works cross-origin for origins listed here — an empty list leaves CORS
// wide open ("*") but without credentials, so browser clients can't send
// the session cookie at all.
AllowedOrigins []string `toml:"allowed_origins"`
}
type ConfiguredFile ¶
type ConfiguredFile struct {
Field, Path string
}
ConfiguredFile is a configured path together with the key that named it.
type DatabaseConfig ¶
type DatabaseConfig struct {
Path string `toml:"path"`
}
type DispatcherConfig ¶
type DispatcherConfig struct {
Server ServerConfig `toml:"server"`
Logging LoggingConfig `toml:"logging"`
Scheduler SchedulerConfig `toml:"scheduler"`
TLS TLSConfig `toml:"tls"`
Database DatabaseConfig `toml:"database"`
Sui SuiConfig `toml:"sui"`
CORS CORSConfig `toml:"cors"`
GitHubOAuth GitHubOAuthConfig `toml:"github_oauth"`
}
func LoadConfig ¶
func LoadConfig(path string) (*DispatcherConfig, error)
LoadConfig reads a TOML config file, applies the documented defaults for omitted keys and validates every supported key. It fails before the command opens the database or binds a listener, so a misspelled or unusable field never reaches a partially started daemon.
func (*DispatcherConfig) TLSFiles ¶
func (cfg *DispatcherConfig) TLSFiles() []ConfiguredFile
TLSFiles lists the certificate files the HTTP API reads, and nothing when TLS is disabled. An optional file is included only when it is configured.
func (*DispatcherConfig) Validate ¶
func (cfg *DispatcherConfig) Validate() error
Validate reports the first unusable configuration field. Defaults for omitted keys are applied by LoadConfig before this runs, so every value seen here is the one the daemon would actually use.
type GitHubOAuthConfig ¶
type LoggingConfig ¶
type SchedulerConfig ¶
type SchedulerConfig struct {
// ExecutorTimeout is the negotiated control lease in seconds, from 1 to 300.
// Heartbeat telemetry is separate from lease renewal.
ExecutorTimeout int `toml:"executor_timeout"`
// SchedulerGranularityMs is the scheduler granularity in milliseconds for time-range capacity tracking.
SchedulerGranularityMs int64 `toml:"scheduler_granularity_ms"`
}
type ServerConfig ¶
type ServerConfig struct {
BindHost string `toml:"bind_host"`
Version string `toml:"version"`
GRPCPort int `toml:"grpc_port"`
HTTPPort int `toml:"http_port"`
// LocalDevelopment asks the HTTP API for its local development profile, in
// which a request that presents no credential at all is served as the
// dispatcher's own local operator. It is an explicit opt-in and is never
// inferred: the daemon additionally requires the environment it describes
// (blockchain payments off, TLS listener off, both listeners on loopback)
// and refuses to start when the key is set without it. Omitted or false
// keeps authentication and authorization enforced.
LocalDevelopment bool `toml:"local_development"`
// BehindTLSTerminator states that a TLS terminator stands in front of this
// dispatcher, so the session cookie is marked Secure although the daemon
// itself serves cleartext. It is configuration because a request cannot be
// trusted to describe its own scheme: X-Forwarded-Proto and its relatives
// are set by whoever sent the request.
BehindTLSTerminator bool `toml:"behind_tls_terminator"`
}
type ServerTLS ¶
type ServerTLS struct {
Combined *tls.Config
Direct *tls.Config
// RequireClientIdentity reports whether an executor must present a
// certificate issued by tls.ca_file on both control channels.
RequireClientIdentity bool
}
ServerTLS is the loaded transport security for the dispatcher's listeners.
Combined carries the HTTP API and the reverse control stream, which share one port behind a protocol multiplexer. The multiplexer reads cleartext framing, so that connection is terminated before it and offers HTTP/1.1 only: an HTTP/2 connection negotiated through ALPN would reach the multiplexer as a preface it cannot route back into a protocol-aware server. Direct is the separate gRPC listener, which offers h2 because gRPC requires it.
Both listeners present the same server identity and trust the same authority, so an executor verifies one name and one root for both of its channels.
func LoadServerTLS ¶
LoadServerTLS reads the configured server identity and trust roots. It returns nil without an error for a plaintext listener, and otherwise fails naming the configuration key an operator has to correct — before the command opens storage or binds a listener, so an unusable certificate never leaves a half-started daemon serving a downgraded connection.
type SuiConfig ¶
type SuiConfig struct {
Network string `toml:"network"` //testnet or mainnet
GRPCEndpoint string `toml:"grpc_endpoint"` // host:port, e.g. fullnode.testnet.sui.io:443
GraphQLURL string `toml:"graphql_url"` // Sui GraphQL RPC, used to catch up on PaymentReceipt events by type
Address string `toml:"address"`
PaymentRegistryId string `toml:"payment_registry_id"`
PaymentKitPackage string `toml:"payment_kit_package"`
KeystorePath string `toml:"keystore_path"`
// Disabled switches blockchain payments off explicitly. When true, the
// dispatcher constructs neither the Sui client/listener nor the payout
// ticker and rejects USDC/SUI payment actions; TEST payments keep working.
// The other Sui fields are ignored in that mode. Omitted or false keeps
// the enabled semantics unchanged; nothing is inferred from empty fields.
Disabled bool `toml:"disabled"`
}
type TLSConfig ¶
type TLSConfig struct {
Disable bool `toml:"disable"`
CertFile string `toml:"cert_file"`
KeyFile string `toml:"key_file"`
CAFile string `toml:"ca_file,omitempty"` // optional for client cert validation
// RequireClientCert makes an executor present a certificate issued by
// CAFile on both control channels: the direct gRPC listener refuses a
// missing identity during the handshake, and the reverse control stream
// on the combined listener is refused after it. The HTTP API shares that
// listener and keeps working without a client certificate.
RequireClientCert bool `toml:"require_client_cert"`
}