all repos

rss-tools @ master

get rss feed from sources that(i need and) dont provide one

rss-tools/app/config.go (view raw)

Oleksandr Smirnov Oleksandr Smirnov
olexsmir@gmail.com
add twtich souce, 9 days ago
1
package app
2
3
import (
4
	"encoding/json"
5
	"os"
6
)
7
8
type Config struct {
9
	Port               int      `json:"port"`
10
	AuthToken          string   `json:"auth_token"`
11
	TGUserID           int64    `json:"tg_userid"`
12
	TGToken            string   `json:"tg_token"`
13
	MoviefeedAPIKey    string   `json:"moviefeed_api_key"`
14
	MoviefeedShows     []string `json:"moviefeed_shows"`
15
	MusicArtists       []string `json:"music_artists"`
16
	MusicMaxAgeDays    int      `json:"music_max_age_days"`
17
	TwitchClientID     string   `json:"twitch_client_id"`
18
	TwitchClientSecret string   `json:"twitch_client_secret"`
19
}
20
21
func NewConfig(fpath string) (*Config, error) {
22
	// TODO per source config
23
24
	configFile, err := os.ReadFile(fpath)
25
	if err != nil {
26
		return nil, err
27
	}
28
29
	var config Config
30
	err = json.Unmarshal(configFile, &config)
31
	return &config, err
32
}