- internal/gemini/ → internal/adapters/openai/ (renamed package to openai) - internal/pexels/ → internal/adapters/pexels/ - internal/config/ → internal/infra/config/ - internal/database/ → internal/infra/database/ - internal/locale/ → internal/infra/locale/ - internal/middleware/ → internal/infra/middleware/ - internal/server/ → internal/infra/server/ All import paths and call sites updated accordingly. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
36 lines
961 B
Go
36 lines
961 B
Go
package config
|
|
|
|
import (
|
|
"time"
|
|
|
|
"github.com/kelseyhightower/envconfig"
|
|
)
|
|
|
|
type Config struct {
|
|
Port int `envconfig:"PORT" default:"8080"`
|
|
DatabaseURL string `envconfig:"DATABASE_URL" required:"true"`
|
|
|
|
// Firebase
|
|
FirebaseCredentialsFile string `envconfig:"FIREBASE_CREDENTIALS_FILE" required:"true"`
|
|
|
|
// JWT
|
|
JWTSecret string `envconfig:"JWT_SECRET" required:"true"`
|
|
JWTAccessDuration time.Duration `envconfig:"JWT_ACCESS_DURATION" default:"15m"`
|
|
JWTRefreshDuration time.Duration `envconfig:"JWT_REFRESH_DURATION" default:"720h"`
|
|
|
|
// CORS
|
|
AllowedOrigins []string `envconfig:"ALLOWED_ORIGINS" default:"http://localhost:3000"`
|
|
|
|
// External APIs
|
|
OpenAIAPIKey string `envconfig:"OPENAI_API_KEY" required:"true"`
|
|
PexelsAPIKey string `envconfig:"PEXELS_API_KEY" required:"true"`
|
|
}
|
|
|
|
func Load() (*Config, error) {
|
|
var cfg Config
|
|
if err := envconfig.Process("", &cfg); err != nil {
|
|
return nil, err
|
|
}
|
|
return &cfg, nil
|
|
}
|