chore: build
ci-api / test (push) Failing after 8m7s
ci-web / test (push) Failing after 5m5s

This commit is contained in:
Xor290
2026-09-20 12:18:33 +02:00
parent 8f4c7fa47a
commit 919c807004
174 changed files with 9669 additions and 1308 deletions
+26 -10
View File
@@ -11,12 +11,13 @@ import (
)
type Config struct {
Database DatabaseConfig
Redis RedisConfig
JWT JWTConfig
Server ServerConfig
Seed SeedConfig
Media MediaConfig
Database DatabaseConfig
Redis RedisConfig
JWT JWTConfig
Server ServerConfig
Seed SeedConfig
Media MediaConfig
Verification VerificationConfig
}
type DatabaseConfig struct {
@@ -41,8 +42,9 @@ type ServerConfig struct {
}
type SeedConfig struct {
AdminEmail string
AdminUsername string
AdminPassword string
AdminNumber int64
}
// MediaConfig configures the pluggable media storage backend. Driver
@@ -64,12 +66,19 @@ type MediaConfig struct {
S3PublicBaseURL string
}
// VerificationConfig configures where customer identity-verification
// documents (front/back ID photos) are stored on disk. Unlike media, this
// is never served through a public URL -- see customerverification.Storage.
type VerificationConfig struct {
UploadDir string
}
func Load() (*Config, error) {
// The .env file lives at the repo root (next to docker-compose.yml),
// but `go run` is commonly invoked from inside backend/. Try both so
// either working directory picks it up; missing files are ignored.
_ = godotenv.Load(".env")
_ = godotenv.Load("../.env")
_ = godotenv.Load("../../../.env")
accessMinutes, err := strconv.Atoi(getEnv("ACCESS_TOKEN_TTL_MINUTES", "15"))
if err != nil {
@@ -119,7 +128,10 @@ func Load() (*Config, error) {
}
}
}
adminNumber, err := strconv.ParseInt(getEnv("ADMIN_NUMBER", "2"), 10, 64)
if err != nil {
return nil, fmt.Errorf("invalid ADMIN_NUMBER: %w", err)
}
return &Config{
Database: DatabaseConfig{
URL: dbURL,
@@ -139,8 +151,9 @@ func Load() (*Config, error) {
CookieSecure: cookieSecure,
},
Seed: SeedConfig{
AdminEmail: os.Getenv("SEED_ADMIN_EMAIL"),
AdminUsername: os.Getenv("SEED_ADMIN_USERNAME"),
AdminPassword: os.Getenv("SEED_ADMIN_PASSWORD"),
AdminNumber: adminNumber,
},
Media: MediaConfig{
Driver: mediaDriver,
@@ -155,6 +168,9 @@ func Load() (*Config, error) {
S3UsePathStyle: s3UsePathStyle,
S3PublicBaseURL: os.Getenv("S3_PUBLIC_BASE_URL"),
},
Verification: VerificationConfig{
UploadDir: getEnv("VERIFICATION_UPLOAD_DIR", "./verification-uploads"),
},
}, nil
}