commands

package
v3.7.3 Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2020 License: Apache-2.0 Imports: 51 Imported by: 0

Documentation

Overview

Package commands implements the commands for the ttn-lw-stack binary.

Index

Constants

This section is empty.

Variables

DefaultConfig contains the default config for the ttn-lw-stack binary.

View Source
var (

	// Root command is the entrypoint of the program
	Root = &cobra.Command{
		Use:           name,
		SilenceErrors: true,
		SilenceUsage:  true,
		Short:         "The Things Stack for LoRaWAN",
		PersistentPreRunE: func(cmd *cobra.Command, args []string) error {

			err := mgr.ReadInConfig()
			if err != nil {
				return err
			}

			if err = mgr.Unmarshal(config); err != nil {
				return err
			}

			logger, err = log.NewLogger(
				log.WithLevel(config.Base.Log.Level),
				log.WithHandler(log.NewCLI(os.Stdout)),
			)

			if config.Sentry.DSN != "" {
				opts := sentry.ClientOptions{
					Dsn:     config.Sentry.DSN,
					Release: pkgversion.String(),
				}
				if hostname, err := os.Hostname(); err == nil {
					opts.ServerName = hostname
				}
				err = sentry.Init(opts)
				if err != nil {
					return err
				}
				logger.Use(logsentry.New())
			}

			ctx = log.NewContext(ctx, logger)

			if err := shared.Initialize(ctx, &config.ServiceBase); err != nil {
				return err
			}

			return err
		},
	}
)

Functions

This section is empty.

Types

type Config

type Config struct {
	conf.ServiceBase `name:",squash"`
	IS               identityserver.Config             `name:"is"`
	GS               gatewayserver.Config              `name:"gs"`
	NS               networkserver.Config              `name:"ns"`
	AS               applicationserver.Config          `name:"as"`
	JS               joinserver.Config                 `name:"js"`
	Console          console.Config                    `name:"console"`
	GCS              gatewayconfigurationserver.Config `name:"gcs"`
	DTC              devicetemplateconverter.Config    `name:"dtc"`
	QRG              qrcodegenerator.Config            `name:"qrg"`
}

Config for the ttn-lw-stack binary.

Jump to

Keyboard shortcuts

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