start

package
v1.4.4 Latest Latest
Warning

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

Go to latest
Published: Jan 14, 2024 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	StartCmd = &cobra.Command{
		Use:           "start",
		Short:         "starts the main process by reading the config file",
		SilenceUsage:  false,
		SilenceErrors: true,
		Example: `# clean the desired files on target bucket
s3-manager clean --min-size-mb=1 --max-size-mb=1000 --keep-last-n-files=2 --sort-by=lastModificationDate --order=ascending
		`,
		RunE: func(cmd *cobra.Command, args []string) error {

			cfg := cmd.Context().Value(options.ConfigKey{}).(*config.Config)
			client := cmd.Context().Value(options.S3ClientKey{}).(aws.S3ClientAPI)
			announcers := cmd.Context().Value(options.AnnouncerKey{}).([]announce.Announcer)
			logger := cmd.Context().Value(options.LoggerKey{}).(zerolog.Logger)

			go func() {
				sigChan := make(chan os.Signal, 1)
				signal.Notify(sigChan, os.Interrupt, syscall.SIGTERM, syscall.SIGINT)
				<-sigChan
				logger.Info().Msg("interrupt signal received., shutting down...")
				cancel()
			}()

			if err := feed.Filter(ctx, cfg, client, announcers); err != nil {
				logger.Error().Err(err).Msg("filtering process failed, shutting down...")
				return err
			}

			return nil
		},
	}
)

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