cmd

package
v0.0.0-...-461217a Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// GitVersion returns latest tag
	GitVersion = "X.X.X"
	// GitHash return hash of latest commit
	GitHash = "XXXXXXX"
)
View Source
var (
	ServeCmd = &cobra.Command{
		Use:   "serve",
		Short: "Run loginapp application",
		Long: `
Perform configuration checks and run Loginapp.

Loginapp supports three configuration formats:
* Configuration file: '--config' flag
* Flags: '--oidc-xxx' flags for example
* Environment vars: each flag provides an environment var with
  'LOGINAPP_' prefix.
  Ex: '--oidc-client-secret' --> 'LOGINAPP_OIDC_CLIENT_SECRET'

Configuration precedence: flags > environment vars > configuration file`,
		Run: func(cmd *cobra.Command, args []string) {
			s := server.New(serveCfg)
			if err := s.Config.Init(); err != nil {
				log.Fatal(err)
			}
			if err := s.Run(); err != nil {
				cmd.SilenceUsage = true
				log.Fatal(err)
			}

			viper.OnConfigChange(func(e fsnotify.Event) {
				log.Info("Configuration changed, reloading...")
				if err := s.Config.Init(); err != nil {
					cmd.SilenceUsage = true
					log.Errorf("Configuration init failed: %v", err)
					log.Info("Still using previous configuration")
				}
			})
		},
	}
)

Functions

func Execute

func Execute()

Types

This section is empty.

Jump to

Keyboard shortcuts

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