daemon

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Oct 5, 2023 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Command = clapp.Command{
	Cobra: &cobra.Command{
		Use:   "daemon",
		Short: "Daemon mode",
		Long:  "Let's Encrypt for NetScaler ADC - Daemon Mode",
		RunE: func(cmd *cobra.Command, args []string) error {
			var err error

			// Get flag values from command
			var file string
			var path string
			var search []string

			file, err = cmd.Flags().GetString("file")
			if err != nil {
				slog.Error("could not find flag", "flag", "file")
				return err
			}

			path, err = cmd.Flags().GetString("path")
			if err != nil {
				slog.Error("could not find flag", "flag", "path")
				return err
			}

			search, err = cmd.Flags().GetStringSlice("search")
			if err != nil {
				slog.Error("could not find flag", "flag", "search")
				return err
			}

			clappConfig := clapp.NewConfiguration(file, path, search)
			viper := clappConfig.GetViper()

			err = viper.ReadInConfig()
			if err != nil {
				slog.Error("could not read configuration", "error", err)
				return err
			}

			var appConfig config.Application
			err = viper.Unmarshal(&appConfig)
			if err != nil {
				slog.Error("could not unmarshal configuration", "error", err)
				return err
			}

			c := command.Daemon{
				Config: appConfig,
			}
			err = c.Execute()
			return err
		},
		SilenceErrors: true,
		SilenceUsage:  true,
	},
}

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