config

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2026 License: AGPL-3.0 Imports: 12 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package config reads the node's settings from the environment. Every setting has a sensible default so that `node-go serve` works with no configuration at all (SQLite and blobs under ./data). Load validates every value and reports all problems at once, so a typo stops the node on start with a clear message instead of misbehaving later.

Index

Constants

This section is empty.

Variables

View Source
var Known = map[string]bool{
	"OBX_PUBLIC_URL": true, "OBX_DATA_DIR": true, "OBX_DATABASE_URL": true, "OBX_BLOB_URL": true,
	"OBX_SECRET_KEY": true, "OBX_SETUP_CODE": true, "OBX_ALLOW_PRIVATE_URLS": true, "OBX_SMTP_URL": true,
	"OBX_MAIL_FROM": true, "OBX_MAIL_LOG_BODIES": true, "OBX_WORKERS": true, "OBX_TRUST_PROXY": true,
	"OBX_LOG_FORMAT": true, "OBX_LOG_LEVEL": true, "OBX_ACCESS_LOG": true, "OBX_METRICS": true,
	"OBX_METRICS_TOKEN": true, "OBX_CUSTOM_DOMAIN_HELP": true, "OBX_TEST_RATE_LIMIT": true,
	"OBX_CHANGE_RETENTION_DAYS": true, "OBX_JOB_RETENTION_DAYS": true, "OBX_WEBHOOK_LOG_RETENTION_DAYS": true,
	"OBX_SHUTDOWN_DELAY": true, "OBX_S3_ACCESS_KEY_ID": true, "OBX_S3_SECRET_ACCESS_KEY": true,
	"OBX_DOMAIN": true, "OBX_TLS": true, "OBX_ACME_EMAIL": true, "OBX_ACME_DIRECTORY": true,
	"OBX_HTTP_PORT": true, "OBX_HTTPS_PORT": true,

	"OBX_URL": true, "OBX_TOKEN": true, "OBX_TEST_DATABASE_URL": true, "OBX_TEST_LOG": true,
	"OBX_TEST_S3_ENDPOINT": true, "OBX_TEST_S3_BLOBS": true, "OBX_TEST_SFTP": true, "OBX_LOAD_TEST": true,
	"OBX_LOAD_PRODUCTS": true, "OBX_ALLOW_PRIVATE": true,
}

Known lists every variable the node reads; others starting with OBX_ are reported as probable typos.

Functions

This section is empty.

Types

type Config

type Config struct {
	PublicURL           string // OBX_PUBLIC_URL, no trailing slash
	Port                int    // PORT
	DataDir             string // OBX_DATA_DIR
	DatabaseURL         string // OBX_DATABASE_URL (sqlite:/path or postgres://)
	BlobURL             string // OBX_BLOB_URL (file:///path, s3://bucket/prefix, gs://bucket/prefix)
	SecretKey           []byte // OBX_SECRET_KEY
	SecretFromEnv       bool   // the key came from OBX_SECRET_KEY (not the data directory)
	SetupCode           string // OBX_SETUP_CODE
	AllowPrivateURLs    bool   // OBX_ALLOW_PRIVATE_URLS
	SMTPURL             string // OBX_SMTP_URL smtp://user:pass@host:587 or smtps://...:465
	MailFrom            string // OBX_MAIL_FROM
	MailLogBodies       bool   // OBX_MAIL_LOG_BODIES (development only)
	Workers             int    // OBX_WORKERS
	TrustProxy          bool   // OBX_TRUST_PROXY: take the client IP from X-Forwarded-For
	LogFormat           string // OBX_LOG_FORMAT text|json
	LogLevel            string // OBX_LOG_LEVEL debug|info|warn|error
	AccessLog           bool   // OBX_ACCESS_LOG: one info line per request (default on)
	Metrics             bool   // OBX_METRICS: serve Prometheus metrics at /metrics
	MetricsToken        string // OBX_METRICS_TOKEN: bearer token required for /metrics
	CustomDomainHelp    string // OBX_CUSTOM_DOMAIN_HELP (Markdown shown in settings)
	TestRateLimit       int    // OBX_TEST_RATE_LIMIT: per-minute API limit override (conformance)
	ChangeRetentionDays int    // OBX_CHANGE_RETENTION_DAYS (>= 90)
	// Retention of operational records (days). Personal and usage data
	// (download statistics, audit log, access requests) follow the brand's
	// own retention settings in the admin.
	JobRetentionDays        int // OBX_JOB_RETENTION_DAYS: finished jobs, batch results, downloads
	WebhookLogRetentionDays int // OBX_WEBHOOK_LOG_RETENTION_DAYS: webhook delivery log
	ShutdownDelaySeconds    int // OBX_SHUTDOWN_DELAY: seconds /readyz reports 503 before the server stops
	// Built-in HTTPS (OBX_TLS=auto): a Let's Encrypt certificate for the
	// portal's domain, served on HTTPSPort, with HTTPPort answering the ACME
	// http-01 challenge and redirecting everything else to https.
	Domain        string // OBX_DOMAIN: the portal's host name; sets the default OBX_PUBLIC_URL
	TLS           string // OBX_TLS: off (default, plain http on PORT) or auto
	ACMEEmail     string // OBX_ACME_EMAIL: Let's Encrypt contact for expiry notices (optional)
	ACMEDirectory string // OBX_ACME_DIRECTORY: ACME directory URL (default Let's Encrypt production)
	HTTPPort      int    // OBX_HTTP_PORT (80)
	HTTPSPort     int    // OBX_HTTPS_PORT (443)
}

Config is the node configuration.

func Load

func Load() (*Config, error)

Load reads and validates the configuration from the environment.

func (*Config) ApplyDefaults

func (c *Config) ApplyDefaults()

ApplyDefaults fills settings left at zero (a Config built in code rather than by Load) with the defaults Load uses.

func (*Config) Host

func (c *Config) Host() string

Host returns the host of the public URL.

func (*Config) Secure

func (c *Config) Secure() bool

Secure reports whether cookies must carry the Secure flag.

func (*Config) TLSHost added in v0.3.1

func (c *Config) TLSHost() string

TLSHost returns the host name the built-in HTTPS gets a certificate for, or "" when OBX_TLS is off.

func (*Config) Warnings

func (c *Config) Warnings() []string

Warnings returns advice about a valid but risky configuration.

Jump to

Keyboard shortcuts

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