config

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Sep 30, 2026 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package config reads the SQLITE_REMOTE_* environment variables of the command. No other package reads the environment. Load parses them into a server.Config, validates it and names the variable in every error.

A program that receives the settings under other names, e.g. from a platform, calls LoadFrom with a function that translates the names.

Index

Constants

View Source
const (
	EnvPort        = "SQLITE_REMOTE_PORT"
	EnvLogLevel    = "SQLITE_REMOTE_LOG_LEVEL"
	EnvServerID    = "SQLITE_REMOTE_SERVER_ID"
	EnvStore       = "SQLITE_REMOTE_STORE"
	EnvDatabaseURL = "SQLITE_REMOTE_DATABASE_URL"
	EnvDBMaxConns  = "SQLITE_REMOTE_DB_MAX_CONNS"
	EnvDBMinConns  = "SQLITE_REMOTE_DB_MIN_CONNS"
	// EnvRequireSyncReplication is true or false.
	EnvRequireSyncReplication = "SQLITE_REMOTE_REQUIRE_SYNC_REPLICATION"
	EnvMaxFrameBytes          = "SQLITE_REMOTE_MAX_FRAME_BYTES"
	EnvMaxCommitBytes         = "SQLITE_REMOTE_MAX_COMMIT_BYTES"
	EnvPingInterval           = "SQLITE_REMOTE_PING_INTERVAL"
	EnvLeaseTTL               = "SQLITE_REMOTE_LEASE_TTL"
	EnvHelloTimeout           = "SQLITE_REMOTE_HELLO_TIMEOUT"
	// EnvAllowedOrigins is a comma-separated list of host patterns.
	EnvAllowedOrigins = "SQLITE_REMOTE_ALLOWED_ORIGINS"
	// EnvDeleteUnusedAfterDays is a number of days. 0 turns the deletion of unused databases off.
	EnvDeleteUnusedAfterDays = "SQLITE_REMOTE_DELETE_UNUSED_AFTER_DAYS"
	EnvTokenJWKSURL          = "SQLITE_REMOTE_TOKEN_JWKS_URL"
	EnvTokenJWKSFile         = "SQLITE_REMOTE_TOKEN_JWKS_FILE"
	EnvTokenIssuer           = "SQLITE_REMOTE_TOKEN_ISSUER"
	EnvTokenAudience         = "SQLITE_REMOTE_TOKEN_AUDIENCE"
	EnvTokenLeeway           = "SQLITE_REMOTE_TOKEN_LEEWAY"
)

Environment variable names.

Variables

This section is empty.

Functions

func Named

func Named(err error) error

Named replaces the field name in a *server.ConfigError with the variable that sets the field. server.Run returns such errors too, for checks it can only make at start. Other errors, and nil, are returned unchanged.

Types

type Config

type Config struct {
	Server   server.Config
	LogLevel slog.Level
}

Config is the configuration of the command.

func Load

func Load() (Config, error)

Load reads and validates the environment variables.

func LoadFrom

func LoadFrom(getenv func(string) string) (Config, error)

LoadFrom reads and validates the variables through getenv, which returns "" for an unset variable.

Jump to

Keyboard shortcuts

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