Documentation
¶
Overview ¶
Package runtime provides environment/runtime detection helpers shared across the service layer.
Package runtime provides environment/runtime detection helpers shared across the service layer.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsDevelopment ¶
func IsDevelopment() bool
func IsDevelopmentOrTesting ¶
func IsDevelopmentOrTesting() bool
func IsProduction ¶
func IsProduction() bool
func ParseEnvDuration ¶
ParseEnvDuration parses a duration from the environment variable with the given key. Returns the parsed duration and true if successful, or 0 and false if not set or invalid.
func ParseEnvInt ¶
ParseEnvInt parses an integer from the environment variable with the given key. Returns the parsed value and true if successful, or 0 and false if not set or invalid.
func StrictIdentityMode ¶
func StrictIdentityMode() bool
StrictIdentityMode returns true when the service should fail closed on identity/security boundaries (e.g. only trust identity headers protected by verified mTLS).
We treat SGX hardware mode (OE_SIMULATION=0) and MarbleRun-injected TLS credentials as "strict" too, so a mis-set MARBLE_ENV cannot silently weaken trust boundaries.
Types ¶
type Environment ¶
type Environment string
Environment represents the logical deployment environment.
This is intentionally lightweight: it is derived from environment variables (primarily MARBLE_ENV) and is safe to use from low-level packages.
const ( Development Environment = "development" Testing Environment = "testing" Production Environment = "production" )
func Env ¶
func Env() Environment
Env returns the current environment derived from MARBLE_ENV (preferred) or ENVIRONMENT (legacy fallback). Unknown values default to Development.
func ParseEnvironment ¶
func ParseEnvironment(raw string) (env Environment, ok bool)
ParseEnvironment parses an environment string (case-insensitive) into a known Environment value. It returns ok=false for unknown inputs.