aboutsummaryrefslogtreecommitdiffhomepage
path: root/cli
diff options
context:
space:
mode:
authorGravatar Frédéric Guillot <fred@miniflux.net>2018-11-11 15:54:19 -0800
committerGravatar Frédéric Guillot <fred@miniflux.net>2018-11-11 15:54:19 -0800
commitbecd086865f35d64a80d01ffb1ca96d0493dfa03 (patch)
tree6dea31c665873162742f29b4b198adb88b65cbcc /cli
parent487852f07eb191ef56967b7b7d7f01537a55eabd (diff)
Add config options to disable HTTP and scheduler services
Diffstat (limited to 'cli')
-rw-r--r--cli/daemon.go16
1 files changed, 13 insertions, 3 deletions
diff --git a/cli/daemon.go b/cli/daemon.go
index 436729c..aa673d4 100644
--- a/cli/daemon.go
+++ b/cli/daemon.go
@@ -6,6 +6,7 @@ package cli // import "miniflux.app/cli"
import (
"context"
+ "net/http"
"os"
"os/signal"
"runtime"
@@ -31,17 +32,26 @@ func startDaemon(cfg *config.Config, store *storage.Storage) {
feedHandler := feed.NewFeedHandler(store)
pool := worker.NewPool(feedHandler, cfg.WorkerPoolSize())
- go scheduler.Serve(cfg, store, pool)
go showProcessStatistics()
- httpServer := httpd.Serve(cfg, store, pool, feedHandler)
+ if cfg.HasSchedulerService() {
+ scheduler.Serve(cfg, store, pool)
+ }
+
+ var httpServer *http.Server
+ if cfg.HasHTTPService() {
+ httpServer = httpd.Serve(cfg, store, pool, feedHandler)
+ }
<-stop
logger.Info("Shutting down the process...")
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
defer cancel()
- httpServer.Shutdown(ctx)
+ if httpServer != nil {
+ httpServer.Shutdown(ctx)
+ }
+
logger.Info("Process gracefully stopped")
}