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,13 +16,13 @@ import (
"miniflux.app/config"
"miniflux.app/logger"
"miniflux.app/reader/feed"
"miniflux.app/service/scheduler"
"miniflux.app/service/httpd"
"miniflux.app/service/scheduler"
"miniflux.app/storage"
"miniflux.app/worker"
)
func startDaemon(cfg *config.Config, store *storage.Storage) {
func startDaemon(store *storage.Storage) {
logger.Info("Starting Miniflux...")
stop := make(chan os.Signal, 1)
@ -30,17 +30,17 @@ func startDaemon(cfg *config.Config, store *storage.Storage) {
signal.Notify(stop, syscall.SIGTERM)
feedHandler := feed.NewFeedHandler(store)
pool := worker.NewPool(feedHandler, cfg.WorkerPoolSize())
pool := worker.NewPool(feedHandler, config.Opts.WorkerPoolSize())
go showProcessStatistics()
if cfg.HasSchedulerService() {
scheduler.Serve(cfg, store, pool)
if config.Opts.HasSchedulerService() {
scheduler.Serve(store, pool)
}
var httpServer *http.Server
if cfg.HasHTTPService() {
httpServer = httpd.Serve(cfg, store, pool, feedHandler)
if config.Opts.HasHTTPService() {
httpServer = httpd.Serve(store, pool, feedHandler)
}
<-stop
@ -64,4 +64,4 @@ func showProcessStatistics() {
runtime.NumGoroutine(), runtime.NumCPU())
time.Sleep(30 * time.Second)
}
}
}