feat(gallery): routes

This commit is contained in:
2026-05-31 10:46:07 +02:00
parent ee3eba3cd9
commit 9282f1f634
22 changed files with 223 additions and 34 deletions
+15 -6
View File
@@ -10,9 +10,10 @@ import (
type Cfg struct {
FileSystem *WebdavConfig `env:", prefix=FILESYSTEM_"`
Cache *ValkeyConfig `env:", prefix=CACHE_"`
Image *ImageConfig `env:", prefix=IMAGE_"`
Tracking *UmamiConfig `env:", prefix=TRACKING_"`
Cache *Valkey `env:", prefix=CACHE_"`
Image *Image `env:", prefix=IMAGE_"`
Tracking *Umami `env:", prefix=TRACKING_"`
Gallery *Gallery `env:", prefix=GALLERY_"`
LogLevel slog.Level `env:"LOG_LEVEL, default=DEBUG"`
}
@@ -23,11 +24,13 @@ type WebdavConfig struct {
Password string `env:"PASSWORD"`
}
type ValkeyConfig struct {
type Valkey struct {
ClientName string `env:"CLIENTNAME"`
Username string `env:"USERNAME"`
Password string `env:"PASSWORD"`
RefreshTime time.Duration `env:"REFRESH_TIME"`
// InitAddress point to valkey nodes.
// Valkey will connect to them one by one and issue a CLUSTER SLOT command to initialize the cluster client until success.
// If len(InitAddress) == 1 and the address is not running in cluster mode, valkey will fall back to the single client mode.
@@ -36,13 +39,17 @@ type ValkeyConfig struct {
InitAddress []string `env:"ADDRESS"`
}
type ImageConfig struct {
type Image struct {
Concurency int64 `env:"CONCURENCY"`
Quality int `env:"QUALITY"`
CacheLifetime time.Duration `env:"CACHE_LIFETIME"`
}
type UmamiConfig struct {
type Gallery struct {
Path string `env:"PATH"`
}
type Umami struct {
ScriptSrc string `env:"SCRIPT_SRC"`
WebsiteID string `env:"WEBSITE_ID"`
}
@@ -64,5 +71,7 @@ func Read(ctx context.Context) (cfg Cfg, err error) {
return
}
slog.Info("rft", "rft", cfg.Cache.RefreshTime)
return
}