1
0
Fork 0
mirror of https://github.com/miniflux/v2.git synced 2025-06-27 16:36:00 +00:00

Refactor config package

- Parse configuration only once during startup time
- Store configuration values in a global variable
This commit is contained in:
Frédéric Guillot 2019-06-01 18:18:09 -07:00 committed by fguillot
parent 04d85b3c63
commit 228862fefa
28 changed files with 922 additions and 624 deletions

View file

@ -16,7 +16,7 @@ import (
)
// SendEntry send the entry to the activated providers.
func SendEntry(cfg *config.Config, entry *model.Entry, integration *model.Integration) {
func SendEntry(entry *model.Entry, integration *model.Integration) {
if integration.PinboardEnabled {
client := pinboard.NewClient(integration.PinboardToken)
err := client.AddBookmark(
@ -64,7 +64,7 @@ func SendEntry(cfg *config.Config, entry *model.Entry, integration *model.Integr
}
if integration.PocketEnabled {
client := pocket.NewClient(cfg.PocketConsumerKey(integration.PocketConsumerKey), integration.PocketAccessToken)
client := pocket.NewClient(config.Opts.PocketConsumerKey(integration.PocketConsumerKey), integration.PocketAccessToken)
if err := client.AddURL(entry.URL, entry.Title); err != nil {
logger.Error("[Integration] UserID #%d: %v", integration.UserID, err)
}