updated to use bun and updated hws modules.
This commit is contained in:
28
internal/config/tmdb.go
Normal file
28
internal/config/tmdb.go
Normal file
@@ -0,0 +1,28 @@
|
||||
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
|
||||
}
|
||||
Reference in New Issue
Block a user