This repository has been archived on 2024-01-06. You can view files and clone it, but cannot push or open issues or pull requests.
Files
srv/controller/controller.go
2020-07-05 22:44:05 -04:00

34 lines
654 B
Go

package controller
import (
"log"
config "github.com/davegallant/srv/config"
feeds "github.com/davegallant/srv/feeds"
)
// Controller keeps everything together
type Controller struct {
Config config.Configuration
Rss *feeds.RSS
CurrentFeed int
}
// Init initiates the controller
func (c *Controller) Init() {
configPath, err := config.GetUserConfigPath()
if err != nil {
log.Fatal("Unable to locate user's config path")
}
c.Config, err = config.LoadConfiguration(configPath)
if err != nil {
log.Fatalf("Unable to load configuration: %s", err)
}
c.Rss = &feeds.RSS{}
c.Rss.Update(c.Config.Feeds)
c.CurrentFeed = 0
}