mirror of
https://github.com/Memo-2023/mana-monorepo.git
synced 2026-05-18 03:49:40 +02:00
Add lightweight Hono + Bun servers for server-only compute endpoints. CRUD is handled by mana-sync, these handle AI + file upload only. Traces: AI guide generation, location sync (Port 3026) Planta: Photo upload (S3), AI plant analysis (Port 3022) NutriPhi: AI meal analysis (photo+text), recommendations (Port 3023) Each uses @manacore/shared-hono for auth/health/errors. ~100-200 LOC. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
56 lines
1.5 KiB
Go
56 lines
1.5 KiB
Go
package config
|
|
|
|
import (
|
|
"github.com/manacore/shared-go/envutil"
|
|
)
|
|
|
|
type Config struct {
|
|
Port int
|
|
|
|
// SearXNG
|
|
SearxngURL string
|
|
SearxngTimeout int // ms
|
|
SearxngDefaultLanguage string
|
|
|
|
// Redis
|
|
RedisHost string
|
|
RedisPort int
|
|
RedisPassword string
|
|
RedisPrefix string
|
|
|
|
// Cache TTLs (seconds)
|
|
CacheSearchTTL int
|
|
CacheExtractTTL int
|
|
|
|
// Extract
|
|
ExtractTimeout int // ms
|
|
ExtractMaxLength int
|
|
ExtractUserAgent string
|
|
|
|
// CORS
|
|
CORSOrigins []string
|
|
}
|
|
|
|
func Load() *Config {
|
|
return &Config{
|
|
Port: envutil.GetInt("PORT", 3021),
|
|
|
|
SearxngURL: envutil.Get("SEARXNG_URL", "http://localhost:8080"),
|
|
SearxngTimeout: envutil.GetInt("SEARXNG_TIMEOUT", 15000),
|
|
SearxngDefaultLanguage: envutil.Get("SEARXNG_DEFAULT_LANGUAGE", "de-DE"),
|
|
|
|
RedisHost: envutil.Get("REDIS_HOST", "localhost"),
|
|
RedisPort: envutil.GetInt("REDIS_PORT", 6379),
|
|
RedisPassword: envutil.Get("REDIS_PASSWORD", ""),
|
|
RedisPrefix: "mana-search:",
|
|
|
|
CacheSearchTTL: envutil.GetInt("CACHE_SEARCH_TTL", 3600),
|
|
CacheExtractTTL: envutil.GetInt("CACHE_EXTRACT_TTL", 86400),
|
|
|
|
ExtractTimeout: envutil.GetInt("EXTRACT_TIMEOUT", 10000),
|
|
ExtractMaxLength: envutil.GetInt("EXTRACT_MAX_LENGTH", 50000),
|
|
ExtractUserAgent: envutil.Get("EXTRACT_USER_AGENT", "Mozilla/5.0 (compatible; ManaSearchBot/1.0; +https://mana.how)"),
|
|
|
|
CORSOrigins: envutil.GetSlice("CORS_ORIGINS", []string{"http://localhost:3000", "http://localhost:5173", "http://localhost:8081"}),
|
|
}
|
|
}
|