config

package
v0.0.0-...-94d7571 Latest Latest
Warning

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

Go to latest
Published: Aug 24, 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 {
	// Server configuration
	Port int `envconfig:"PORT" default:"10001"`

	// Port for the Prometheus metrics endpoint. Served on a separate
	// listener so scrapes bypass the scale-to-zero middleware and the
	// external API surface.
	MetricsPort int `envconfig:"METRICS_PORT" default:"10002"`

	// Recording configuration
	FrameRate   int    `envconfig:"FRAME_RATE" default:"10"`
	DisplayNum  int    `envconfig:"DISPLAY_NUM" default:"1"`
	MaxSizeInMB int    `envconfig:"MAX_SIZE_MB" default:"500"`
	OutputDir   string `envconfig:"OUTPUT_DIR" default:"."`
	// AudioSource and PulseServer default to empty, i.e. video-only. Setting both
	// enables audio capture; their values must match the topology defined in
	// shared/start-pulseaudio.sh (the authority for the sink/source/socket). The
	// image's supervisor conf sets both.
	AudioSource string `envconfig:"AUDIO_SOURCE" default:""`
	PulseServer string `envconfig:"PULSE_SERVER" default:""`

	// Absolute or relative path to the ffmpeg binary. If empty the code falls back to "ffmpeg" on $PATH.
	PathToFFmpeg string `envconfig:"FFMPEG_PATH" default:"ffmpeg"`

	// DevTools proxy configuration
	DevToolsProxyPort int  `envconfig:"DEVTOOLS_PROXY_PORT" default:"9222"`
	LogCDPMessages    bool `envconfig:"LOG_CDP_MESSAGES" default:"false"`

	// How long to wait after the last active request before re-enabling scale-to-zero.
	ScaleToZeroCooldown time.Duration `envconfig:"SCALE_TO_ZERO_COOLDOWN" default:"1s"`

	// ChromeDriver proxy: external port where the proxy listens.
	ChromeDriverProxyPort int `envconfig:"CHROMEDRIVER_PROXY_PORT" default:"9224"`
	// Internal ChromeDriver upstream used by the ChromeDriver proxy.
	ChromeDriverUpstreamAddr string `envconfig:"CHROMEDRIVER_UPSTREAM_ADDR" default:"127.0.0.1:9225"`
	// DevTools proxy address passed to ChromeDriver as goog:chromeOptions.debuggerAddress.
	// If empty, it is derived from DevToolsProxyPort as 127.0.0.1:<port>.
	DevToolsProxyAddr string `envconfig:"DEVTOOLS_PROXY_ADDR" default:""`

	// S2 durable event storage. All three fields must be set to enable the S2 sink.
	S2Basin       string `envconfig:"S2_BASIN"        default:""`
	S2AccessToken string `envconfig:"S2_ACCESS_TOKEN" default:""`
	S2Stream      string `envconfig:"S2_STREAM"       default:""`

	// Browser-telemetry OTLP export. OTLPEndpoint (host[:port]) must be set to
	// enable the OTLP sink. The BTEL_ prefix avoids collision with the standard
	// OTEL_ vars that configure the API server's own telemetry.
	OTLPEndpoint    string `envconfig:"BTEL_OTLP_ENDPOINT"     default:""`
	OTLPPath        string `envconfig:"BTEL_OTLP_PATH"         default:"/v1/logs"`
	OTLPInsecure    bool   `envconfig:"BTEL_OTLP_INSECURE"     default:"false"`
	OTLPServiceName string `envconfig:"BTEL_OTLP_SERVICE_NAME" default:"kernel-browser"`
	// OTLP batch tuning. Defaults match the OTel SDK's, so leaving these unset
	// preserves prior behavior. MaxQueueSize is the backpressure buffer: once
	// full, the oldest records are dropped (see the drop metric). It must be at
	// least the export batch size (validated); a smaller queue would drop before
	// a batch fills.
	OTLPMaxQueueSize   int           `envconfig:"BTEL_OTLP_MAX_QUEUE_SIZE" default:"2048"`
	OTLPExportInterval time.Duration `envconfig:"BTEL_OTLP_EXPORT_INTERVAL" default:"1s"`
	OTLPExportTimeout  time.Duration `envconfig:"BTEL_OTLP_EXPORT_TIMEOUT"  default:"30s"`
	// Platform-injected identity, reused to stamp the OTLP Resource. These are
	// the same envs the VM already receives.
	InstanceJWT  string `envconfig:"KERNEL_INSTANCE_JWT" default:""`
	InstanceName string `envconfig:"INST_NAME"           default:""`
	MetroName    string `envconfig:"METRO_NAME"          default:""`
}

Config holds all configuration for the server

func Load

func Load() (*Config, error)

Load loads configuration from environment variables

func (*Config) LogValue

func (c *Config) LogValue() slog.Value

LogValue implements slog.LogValuer, redacting secret fields.

Jump to

Keyboard shortcuts

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