cmd

package
v0.1.277 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 5, 2023 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	RootCmd = &cobra.Command{
		Use:   "syncer",
		Short: "Tool listening for changes from Arweave nodes",

		PersistentPreRunE: func(cmd *cobra.Command, args []string) (err error) {

			applicationCtx, applicationCtxCancel = context.WithCancel(context.Background())

			signalChannel = make(chan os.Signal, 1)
			signal.Notify(signalChannel, os.Interrupt, syscall.SIGTERM)

			conf, err = config.Load(cfgFile)
			if err != nil {
				return
			}
			applicationCtx = common.SetConfig(applicationCtx, conf)

			go func() {
				select {
				case <-signalChannel:
					applicationCtxCancel()
				case <-applicationCtx.Done():
				}
			}()

			err = logger.Init(conf)
			if err != nil {
				return
			}

			return
		},

		PersistentPostRunE: func(cmd *cobra.Command, args []string) (err error) {
			defer func() {
				signal.Stop(signalChannel)
				applicationCtxCancel()
			}()

			<-applicationCtx.Done()

			return
		},
	}
)

Functions

This section is empty.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL