CI / changes (push) Successful in 9s
CI / commitlint (push) Has been skipped
CI / openapi (push) Successful in 26s
CI / web (push) Successful in 33s
CI / go (push) Successful in 56s
CI / bird2 (push) Successful in 14s
CI / release (push) Successful in 20s
Added new endpoints for estimating and executing runtime log auto-cleanup based on tenant settings. Introduced configuration options for auto-cleanup policies, including scheduling and file size limits. Updated the API documentation and UI components to reflect these changes, improving user interaction with runtime log management. Enhanced error handling and added new UI elements for better visibility of audit logs and cleanup actions.
49 lines
1.5 KiB
Go
49 lines
1.5 KiB
Go
// Package config loads control-plane settings from the environment (see architecture plan §1).
|
|
package config
|
|
|
|
import (
|
|
"os"
|
|
"path/filepath"
|
|
"strings"
|
|
)
|
|
|
|
// Env holds shared process configuration for cmd/* entrypoints.
|
|
type Env struct {
|
|
HTTPAddr string
|
|
ServiceName string
|
|
GitSHA string
|
|
// DatabaseURL is the PostgreSQL DSN when SQL-backed repositories are wired (empty in dev).
|
|
DatabaseURL string
|
|
// BrokerURL is NATS/Redis when the reference profile uses a message broker (empty in microVPS).
|
|
BrokerURL string
|
|
// RuntimeLogsDir is the absolute host path to Docker runtime log files (evobgp-all only).
|
|
RuntimeLogsDir string
|
|
// RuntimeLogsPolicyTenant overrides which tenant global_settings drive auto-cleanup (optional).
|
|
RuntimeLogsPolicyTenant string
|
|
}
|
|
|
|
// Load reads EVOBGP_* environment variables with safe defaults.
|
|
func Load() Env {
|
|
e := Env{
|
|
HTTPAddr: ":8080",
|
|
}
|
|
if v := strings.TrimSpace(os.Getenv("EVOBGP_HTTP_ADDR")); v != "" {
|
|
e.HTTPAddr = v
|
|
}
|
|
if v := strings.TrimSpace(os.Getenv("EVOBGP_SERVICE")); v != "" {
|
|
e.ServiceName = v
|
|
}
|
|
e.GitSHA = strings.TrimSpace(os.Getenv("EVOBGP_GIT_SHA"))
|
|
e.DatabaseURL = strings.TrimSpace(os.Getenv("EVOBGP_DATABASE_URL"))
|
|
e.BrokerURL = strings.TrimSpace(os.Getenv("EVOBGP_BROKER_URL"))
|
|
e.RuntimeLogsPolicyTenant = strings.TrimSpace(os.Getenv("EVOBGP_RUNTIME_LOGS_POLICY_TENANT"))
|
|
if v := strings.TrimSpace(os.Getenv("EVOBGP_RUNTIME_LOGS_DIR")); v != "" {
|
|
if abs, err := filepath.Abs(v); err == nil {
|
|
e.RuntimeLogsDir = abs
|
|
} else {
|
|
e.RuntimeLogsDir = v
|
|
}
|
|
}
|
|
return e
|
|
}
|