mirror of
https://github.com/binwiederhier/ntfy.git
synced 2025-06-25 22:08:03 +02:00
Cache
This commit is contained in:
parent
b775e6dfce
commit
67922b0ae5
8 changed files with 175 additions and 6 deletions
cmd
|
@ -19,6 +19,7 @@ func New() *cli.App {
|
|||
flags := []cli.Flag{
|
||||
&cli.StringFlag{Name: "config", Aliases: []string{"c"}, EnvVars: []string{"NTFY_CONFIG_FILE"}, Value: "/etc/ntfy/config.yml", DefaultText: "/etc/ntfy/config.yml", Usage: "config file"},
|
||||
altsrc.NewStringFlag(&cli.StringFlag{Name: "listen-http", Aliases: []string{"l"}, EnvVars: []string{"NTFY_LISTEN_HTTP"}, Value: config.DefaultListenHTTP, Usage: "ip:port used to as listen address"}),
|
||||
altsrc.NewStringFlag(&cli.StringFlag{Name: "cache-file", Aliases: []string{"C"}, EnvVars: []string{"NTFY_CACHE_FILE"}, Usage: "cache file used for message caching"}),
|
||||
altsrc.NewStringFlag(&cli.StringFlag{Name: "firebase-key-file", Aliases: []string{"F"}, EnvVars: []string{"NTFY_FIREBASE_KEY_FILE"}, Usage: "Firebase credentials file; if set additionally publish to FCM topic"}),
|
||||
altsrc.NewDurationFlag(&cli.DurationFlag{Name: "message-buffer-duration", Aliases: []string{"b"}, EnvVars: []string{"NTFY_MESSAGE_BUFFER_DURATION"}, Value: config.DefaultMessageBufferDuration, Usage: "buffer messages in memory for this time to allow `since` requests"}),
|
||||
altsrc.NewDurationFlag(&cli.DurationFlag{Name: "keepalive-interval", Aliases: []string{"k"}, EnvVars: []string{"NTFY_KEEPALIVE_INTERVAL"}, Value: config.DefaultKeepaliveInterval, Usage: "default interval of keepalive messages"}),
|
||||
|
@ -44,6 +45,7 @@ func New() *cli.App {
|
|||
func execRun(c *cli.Context) error {
|
||||
// Read all the options
|
||||
listenHTTP := c.String("listen-http")
|
||||
cacheFile := c.String("cache-file")
|
||||
firebaseKeyFile := c.String("firebase-key-file")
|
||||
messageBufferDuration := c.Duration("message-buffer-duration")
|
||||
keepaliveInterval := c.Duration("keepalive-interval")
|
||||
|
@ -62,6 +64,7 @@ func execRun(c *cli.Context) error {
|
|||
|
||||
// Run server
|
||||
conf := config.New(listenHTTP)
|
||||
conf.CacheFile = cacheFile
|
||||
conf.FirebaseKeyFile = firebaseKeyFile
|
||||
conf.MessageBufferDuration = messageBufferDuration
|
||||
conf.KeepaliveInterval = keepaliveInterval
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue