diff options
author | Frédéric Guillot <fred@miniflux.net> | 2019-06-01 18:18:09 -0700 |
---|---|---|
committer | fguillot <fred@miniflux.net> | 2019-06-02 06:30:08 -0700 |
commit | 228862fefaa645026caa483ffe9993bf8c00b22e (patch) | |
tree | 2b590dc6cda3e50928a31ce673641357805f75ce /cli/daemon.go | |
parent | 04d85b3c63afcf6c9539fc8dc7a91c4e36c2e8fb (diff) |
Refactor config package
- Parse configuration only once during startup time
- Store configuration values in a global variable
Diffstat (limited to 'cli/daemon.go')
-rw-r--r-- | cli/daemon.go | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/cli/daemon.go b/cli/daemon.go index aa673d4..dc12087 100644 --- a/cli/daemon.go +++ b/cli/daemon.go @@ -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) } -}
\ No newline at end of file +} |