feat(m1): backend scaffold - entries CRUD, start/stop, auth, migrations

This commit is contained in:
2026-04-30 16:35:06 +02:00
parent 4905c6f570
commit 3aa068efd2
19 changed files with 1483 additions and 0 deletions

45
internal/config/config.go Normal file
View File

@@ -0,0 +1,45 @@
package config
import (
"fmt"
"os"
)
// Config holds runtime configuration loaded from environment variables.
type Config struct {
AuthToken string
Port string
DBPath string
Timezone string
}
// Load reads configuration from environment variables, returning an error if
// required variables are missing.
func Load() (*Config, error) {
token := os.Getenv("AUTH_TOKEN")
if token == "" {
return nil, fmt.Errorf("AUTH_TOKEN environment variable is required")
}
port := os.Getenv("PORT")
if port == "" {
port = "8080"
}
dbPath := os.Getenv("DB_PATH")
if dbPath == "" {
dbPath = "wotra.db"
}
tz := os.Getenv("TZ")
if tz == "" {
tz = "UTC"
}
return &Config{
AuthToken: token,
Port: port,
DBPath: dbPath,
Timezone: tz,
}, nil
}