Documentation
¶
Overview ¶
Package config loads runtime configuration from the environment.
Index ¶
- func RedactSecret(s string) string
- func RedactURL(raw string) string
- type Config
- func (c *Config) B2Configured() bool
- func (c *Config) B2ImagesConfigured() bool
- func (c *Config) B2ImagesPartiallyConfigured() bool
- func (c *Config) B2MediaPartiallyConfigured() bool
- func (c *Config) B2PartiallyConfigured() bool
- func (c *Config) DotenvPath() string
- func (c *Config) IsProduction() bool
- func (c *Config) RedisAddr() string
- func (c *Config) SourceOf(field string) Source
- type Source
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RedactSecret ¶
RedactSecret masks a bare secret, keeping only enough to confirm which value is loaded. Short secrets are masked wholesale — revealing a prefix of a 6-character password gives away most of it.
func RedactURL ¶
RedactURL strips credentials from a connection string so it can be printed. On a parse failure it returns a fixed placeholder rather than the original: an unparseable DSN is exactly the case where a password is most likely to be sitting in a weird position, and leaking it into a terminal someone screen- shares is worse than an unhelpful log line.
Types ¶
type Config ¶
type Config struct {
// Postgres. api/src/db.ts falls back to a local socket URL; we keep the
// same default so `doctor` behaves identically to the TS services.
DatabaseURL string
DatabaseMaxConnections int
DatabaseReadURL string
DatabaseReadMaxConnections int
// Shared Valkey. River stores jobs in Postgres, so one Valkey now owns the
// disposable response caches, coordination state, and pub/sub channels.
RedisHost string
RedisPort int
RedisPassword string
RedisDB int
// Memgraph, over Bolt.
MemgraphURL string
// EVE SSO / ESI. The client credentials are the production application's
// even locally: refresh tokens in user_esi_tokens are bound to the issuing
// client_id and cannot be exchanged by a different application.
EVEClientID string
EVEClientSecret string
EVECallbackURL string
// ESIUserAgent identifies us to CCP. Required by their acceptable-use
// policy, and the static-data endpoints may throttle requests without it.
ESIUserAgent string
// Optional third-party API keys used by the comments surface. The NUXT_*
// aliases are accepted during migration, but Go owns these integrations.
OpenAIAPIKey string
KlipyAPIKey string
// S3-compatible Backblaze B2 storage used for custom-domain images.
// Names match frontend/server/utils/storage.ts so the Go process can take
// over without changing deployment secrets.
B2Endpoint string
B2MediaBucket string
B2ImagesBucket string
B2KeyID string
B2AppKey string
// ImageStoragePath selects durable local filesystem storage for images.
// When set it takes precedence over the legacy B2 image bucket.
ImageStoragePath string
// ImageCacheBytes bounds the encoded-response LRU owned by `shrike serve`.
// It is a ceiling, not a reservation, and is deliberately not used by
// workers or import commands.
ImageCacheBytes int64
// APICacheBytes bounds the process-local L1 for API responses. Valkey is
// the shared L2 and remains authoritative across instances.
APICacheBytes int64
// HTTP listener for whatever `serve` subcommand is running.
Port int
// DataDir holds writable runtime state: ingress certificates and import caches.
DataDir string
// Observability / environment.
NodeEnv string
GitSHA string
LogLevel string
LogJSON bool
// contains filtered or unexported fields
}
func Load ¶
Load reads .env files (nearest first, walking up from cwd) and then the process environment, which always wins. Missing values fall back to the same defaults the TS services use.
func (*Config) B2Configured ¶
B2Configured reports whether the complete existing frontend storage contract is available. B2PartiallyConfigured distinguishes a deliberately disabled local setup from a deployment typo that should fail loudly.
func (*Config) B2ImagesConfigured ¶
B2ImagesConfigured reports whether the dedicated image bucket and shared B2 credentials are complete.
func (*Config) B2ImagesPartiallyConfigured ¶
func (*Config) B2MediaPartiallyConfigured ¶
B2MediaPartiallyConfigured and B2ImagesPartiallyConfigured distinguish a deliberately omitted bucket from incomplete shared credentials. Once the endpoint and credentials are complete, either bucket may independently be disabled by leaving its name empty.
func (*Config) B2PartiallyConfigured ¶
func (*Config) DotenvPath ¶
DotenvPath returns the .env file that was loaded, or "" if none was found.
func (*Config) IsProduction ¶
IsProduction reports whether we are running with production semantics. NODE_ENV is checked rather than a Go-specific variable because the whole deployment already keys off it.