Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var RedisConnectRetries = 10
RedisConnectRetries indicates how many times the Redis connection should be retried
View Source
var RedisConnectRetryDelay = 1 * time.Second
RedisConnectRetryDelay indicates the time between Redis connection retries
View Source
var RootCmd = &cobra.Command{ Use: "ttn", Short: "The Things Network's backend servers", Long: `ttn launches The Things Network's backend servers`, PersistentPreRun: func(cmd *cobra.Command, args []string) { var logLevel = log.InfoLevel if viper.GetBool("debug") { logLevel = log.DebugLevel } var logHandlers []log.Handler if !viper.GetBool("no-cli-logs") { logHandlers = append(logHandlers, levelHandler.New(cliHandler.New(os.Stdout), logLevel)) } if logFileLocation := viper.GetString("log-file"); logFileLocation != "" { absLogFileLocation, err := filepath.Abs(logFileLocation) if err != nil { panic(err) } logFile, err = os.OpenFile(absLogFileLocation, os.O_WRONLY|os.O_APPEND|os.O_CREATE, 0644) if err != nil { panic(err) } if err == nil { logHandlers = append(logHandlers, levelHandler.New(jsonHandler.New(logFile), logLevel)) } } if esServer := viper.GetString("elasticsearch"); esServer != "" { esClient := elastic.New(esServer) esClient.HTTPClient = &http.Client{ Timeout: 5 * time.Second, } logHandlers = append(logHandlers, levelHandler.New(esHandler.New(&esHandler.Config{ Client: esClient, Prefix: cmd.Name(), BufferSize: 10, }), logLevel)) } ctx = &log.Logger{ Handler: multiHandler.New(logHandlers...), } ttnlog.Set(apex.Wrap(ctx)) grpclog.SetLogger(grpc.Wrap(ttnlog.Get())) ctx.WithFields(log.Fields{ "ComponentID": viper.GetString("id"), "Description": viper.GetString("description"), "Discovery Server Address": viper.GetString("discovery-address"), "Auth Servers": viper.GetStringMapString("auth-servers"), "Monitors": viper.GetStringMapString("monitor-servers"), }).Info("Initializing The Things Network") }, PersistentPostRun: func(cmd *cobra.Command, args []string) { if logFile != nil { logFile.Close() } }, }
RootCmd is executed when ttn is executed without a subcommand
Functions ¶
Types ¶
This section is empty.
Source Files ¶
Click to show internal directories.
Click to hide internal directories.