package config import ( "git.haelnorr.com/h/golib/env" "git.haelnorr.com/h/golib/tmdb" "github.com/pkg/errors" ) type TMDBConfig struct { Token string // ENV TMDB_TOKEN: API token for TMDB (required) Config *tmdb.Config // Config data for interfacing with TMDB } func setupTMDB() (*TMDBConfig, error) { token := env.String("TMDB_TOKEN", "") if token == "" { return nil, errors.New("No TMDB API Token provided") } tmdbcfg, err := tmdb.GetConfig(token) if err != nil { return nil, errors.Wrap(err, "tmdb.GetConfig") } cfg := &TMDBConfig{ Token: token, Config: tmdbcfg, } return cfg, nil }