commands

package
v3.14.2 Latest Latest
Warning

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

Go to latest
Published: Aug 27, 2021 License: Apache-2.0 Imports: 62 Imported by: 0

Documentation

Overview

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

Index

Constants

This section is empty.

Variables

View Source
var DefaultConfig = MakeDefaultConfig(defaultGRPCAddress, defaultOAuthServerAddress, defaultInsecure)

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

View Source
var (

	// Root command is the entrypoint of the program
	Root = &cobra.Command{
		Use:               name,
		SilenceErrors:     true,
		SilenceUsage:      true,
		Short:             "The Things Network Command-line Interface",
		PersistentPreRunE: preRun(checkAuth, refreshToken, requireAuth),
		PersistentPostRunE: func(cmd *cobra.Command, args []string) error {

			api.CloseAll()

			select {
			case <-ctx.Done():
			case <-time.After(versionCheckTimeout):
				logger.Warn("Version check timed out")
			case versionUpdate, ok := <-versionUpdate:
				if ok {
					pkgversion.LogUpdate(ctx, &versionUpdate)
				}
			}

			err := util.SaveAuthCache(cache)
			if err != nil {
				return err
			}

			return ctx.Err()
		},
	}
)

Functions

This section is empty.

Types

type Config

type Config struct {
	conf.Base                          `name:",squash"`
	CredentialsID                      string `name:"credentials-id" yaml:"credentials-id" description:"Credentials ID (if using multiple configurations)"`
	InputFormat                        string `name:"input-format" yaml:"input-format" description:"Input format"`
	OutputFormat                       string `name:"output-format" yaml:"output-format" description:"Output format"`
	AllowUnknownHosts                  bool   `name:"allow-unknown-hosts" yaml:"allow-unknown-hosts" description:"Allow sending credentials to unknown hosts"`
	OAuthServerAddress                 string `name:"oauth-server-address" yaml:"oauth-server-address" description:"OAuth Server address"`
	IdentityServerGRPCAddress          string `name:"identity-server-grpc-address" yaml:"identity-server-grpc-address" description:"Identity Server address"`
	GatewayServerEnabled               bool   `name:"gateway-server-enabled" yaml:"gateway-server-enabled" description:"Gateway Server enabled"`
	GatewayServerGRPCAddress           string `name:"gateway-server-grpc-address" yaml:"gateway-server-grpc-address" description:"Gateway Server address"`
	NetworkServerEnabled               bool   `name:"network-server-enabled" yaml:"network-server-enabled" description:"Network Server enabled"`
	NetworkServerGRPCAddress           string `name:"network-server-grpc-address" yaml:"network-server-grpc-address" description:"Network Server address"`
	ApplicationServerEnabled           bool   `name:"application-server-enabled" yaml:"application-server-enabled" description:"Application Server enabled"`
	ApplicationServerGRPCAddress       string `name:"application-server-grpc-address" yaml:"application-server-grpc-address" description:"Application Server address"`
	JoinServerEnabled                  bool   `name:"join-server-enabled" yaml:"join-server-enabled" description:"Join Server enabled"`
	JoinServerGRPCAddress              string `name:"join-server-grpc-address" yaml:"join-server-grpc-address" description:"Join Server address"`
	DeviceTemplateConverterGRPCAddress string `` /* 139-byte string literal not displayed */
	DeviceClaimingServerGRPCAddress    string `` /* 130-byte string literal not displayed */
	QRCodeGeneratorGRPCAddress         string `name:"qr-code-generator-grpc-address" yaml:"qr-code-generator-grpc-address" description:"QR Code Generator address"`
	PacketBrokerAgentGRPCAddress       string `name:"packet-broker-agent-grpc-address" yaml:"packet-broker-agent-grpc-address" description:"Packet Broker Agent address"`
	Insecure                           bool   `name:"insecure" yaml:"insecure" description:"Connect without TLS"`
	CA                                 string `name:"ca" yaml:"ca" description:"CA certificate file"`
	DumpRequests                       bool   `name:"dump-requests" yaml:"dump-requests" description:"When log level is set to debug, also dump request payload as JSON"`
	SkipVersionCheck                   bool   `name:"skip-version-check" yaml:"skip-version-check" description:"Do not perform version checks"`
}

Config for the ttn-lw-cli binary.

func MakeDefaultConfig

func MakeDefaultConfig(clusterGRPCAddress string, oauthServerAddress string, insecure bool) Config

MakeDefaultConfig builds the default config for the ttn-lw-cli binary for a given host.

Jump to

Keyboard shortcuts

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