1
0
forked from wrenn/wrenn

Add production file logging with logrotate support

Both control plane and host agent now write structured slog output to
$WRENN_DIR/logs/ in addition to stderr. Log level is configurable via
LOG_LEVEL env var (default: info). SIGHUP reopens the log file so
logrotate can rotate without copytruncate.
This commit is contained in:
2026-04-16 15:09:26 +06:00
parent 44c32587e3
commit bba5f80294
6 changed files with 168 additions and 9 deletions

View File

@ -14,6 +14,7 @@ type Config struct {
RedisURL string
ListenAddr string
JWTSecret string
WrennDir string // WRENN_DIR — base directory for wrenn data (logs, etc.)
// mTLS — CP→Agent channel. Both must be set to enable mTLS; omitting either
// disables cert issuance and leaves agent connections on plain HTTP (dev mode).
@ -48,6 +49,7 @@ func Load() Config {
RedisURL: envOrDefault("REDIS_URL", "redis://localhost:6379/0"),
ListenAddr: envOrDefault("WRENN_CP_LISTEN_ADDR", ":8080"),
JWTSecret: os.Getenv("JWT_SECRET"),
WrennDir: envOrDefault("WRENN_DIR", "/var/lib/wrenn"),
CACert: os.Getenv("WRENN_CA_CERT"),
CAKey: os.Getenv("WRENN_CA_KEY"),