feat: add YouTube engine with config file and env support

YouTube Data API v3 engine:
- Add YouTubeConfig to EnginesConfig with api_key field
- Add YOUTUBE_API_KEY env override
- Thread *config.Config through search service to factory
- Factory falls back to env vars if config fields are empty
- Update config.example.toml with youtube section

Also update default local_ported to include google and youtube.
This commit is contained in:
Franz Kafka 2026-03-22 01:57:13 +00:00
parent 38122385bd
commit 41b80a939a
5 changed files with 47 additions and 12 deletions

View file

@ -7,15 +7,17 @@ import (
"time"
"github.com/metamorphosis-dev/kafka/internal/cache"
"github.com/metamorphosis-dev/kafka/internal/config"
"github.com/metamorphosis-dev/kafka/internal/contracts"
"github.com/metamorphosis-dev/kafka/internal/engines"
"github.com/metamorphosis-dev/kafka/internal/upstream"
)
type ServiceConfig struct {
UpstreamURL string
HTTPTimeout time.Duration
Cache *cache.Cache
UpstreamURL string
HTTPTimeout time.Duration
Cache *cache.Cache
EnginesConfig *config.Config
}
type Service struct {
@ -44,7 +46,7 @@ func NewService(cfg ServiceConfig) *Service {
return &Service{
upstreamClient: up,
planner: engines.NewPlannerFromEnv(),
localEngines: engines.NewDefaultPortedEngines(httpClient),
localEngines: engines.NewDefaultPortedEngines(httpClient, cfg.EnginesConfig),
cache: cfg.Cache,
}
}