config

package
v0.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 26, 2026 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	SMTP         SMTPConfig         `yaml:"smtp"`
	HTTP         HTTPConfig         `yaml:"http"`
	Database     DatabaseConfig     `yaml:"database"`
	OAuth        OAuthConfig        `yaml:"oauth"`
	Signing      SigningConfig      `yaml:"signing"`
	OutboundSMTP OutboundSMTPConfig `yaml:"outbound_smtp"`
	Env          string             `yaml:"env"` // "development" or "production"
	// SharedDomain enables slug-based agent registration. When set
	// (e.g. "agents.example.com"), users can register agents with just a
	// slug and get `<slug>@<shared_domain>` provisioned without DNS
	// setup. Empty disables slug registration — every agent must use a
	// custom domain that the user owns and verifies. The shared domain
	// itself is reserved: it cannot be claimed as a custom domain.
	SharedDomain string `yaml:"shared_domain"`
}

func Load

func Load(path string) (*Config, error)

func (*Config) IsProduction

func (c *Config) IsProduction() bool

func (*Config) Validate

func (c *Config) Validate() error

Validate enforces invariants that must hold before the server starts. In production mode the placeholder HMAC secret, an empty secret, and secrets shorter than the hash output length are hard rejected — running with any of these lets attackers forge X-E2A-Auth-* headers and approve HITL messages.

type DatabaseConfig

type DatabaseConfig struct {
	URL string `yaml:"url"`
}

type HTTPConfig

type HTTPConfig struct {
	ListenAddr string `yaml:"listen_addr"`
	// PublicURL is the externally visible base URL of the API, used to
	// build absolute links in notification emails (e.g. HITL magic-link
	// approve/reject). Example: "https://e2a.example.com". If empty,
	// features that need absolute URLs gracefully degrade.
	PublicURL string `yaml:"public_url"`
}

type OAuthConfig

type OAuthConfig struct {
	GoogleClientID     string `yaml:"google_client_id"`
	GoogleClientSecret string `yaml:"google_client_secret"`
	RedirectURL        string `yaml:"redirect_url"`
}

type OutboundSMTPConfig

type OutboundSMTPConfig struct {
	Host       string `yaml:"host"`
	Port       int    `yaml:"port"`
	Username   string `yaml:"username"`
	Password   string `yaml:"password"`
	FromDomain string `yaml:"from_domain"`
}

type SMTPConfig

type SMTPConfig struct {
	ListenAddr string `yaml:"listen_addr"`
	Domain     string `yaml:"domain"`
	TLSCert    string `yaml:"tls_cert"`
	TLSKey     string `yaml:"tls_key"`
}

type SigningConfig

type SigningConfig struct {
	HMACSecret string `yaml:"hmac_secret"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL