Skip to content
Snippets Groups Projects
Commit 4c34eeb1 authored by Josh Brooks's avatar Josh Brooks
Browse files

Merge branch 'release' into 'master'

UDB Release

See merge request elixxir/user-discovery-bot!88
parents 1880e239 5e34ce5e
No related branches found
No related tags found
No related merge requests found
......@@ -24,6 +24,6 @@ update_master:
GOFLAGS="" go get -u gitlab.com/elixxir/comms@master
GOFLAGS="" go get -u gitlab.com/elixxir/client@master
master: update update_master build
master: update_master update build
release: update update_release build
release: update_release update build
......@@ -11,7 +11,7 @@ The user discovery bot helps users make first contact with other users. Users ca
|---|---|---|---|
|--config| |Specify a different configuration file|--config udb2.yaml|
|--help|-h|Shows a help message|-h|
|--verbose|-v|Prints more log messages|-v|
|--logLevel|-l|Sets the log message level to print. (0 = info, 1 = debug, >1 = trace)|-v 2|
|--version|-V|Prints generated version information for the UDB and its dependencies. To regenerate log messages, run `$ go generate cmd/version.go`.|-V|
|--ndf|-n|Path to the network definition file|-V|
......
......@@ -15,6 +15,7 @@ import (
"github.com/spf13/viper"
"gitlab.com/elixxir/client/api"
"gitlab.com/elixxir/client/globals"
"gitlab.com/elixxir/comms/mixmessages"
"gitlab.com/elixxir/primitives/utils"
"gitlab.com/elixxir/user-discovery-bot/storage"
"gitlab.com/elixxir/user-discovery-bot/udb"
......@@ -22,7 +23,7 @@ import (
)
var cfgFile string
var verbose bool
var logLevel uint // 0 = info, 1 = debug, >1 = trace
var noTLS bool
// RootCmd represents the base command when called without any subcommands
......@@ -88,8 +89,8 @@ func init() {
// will be global for your application.
RootCmd.Flags().StringVarP(&cfgFile, "config", "", "",
"config file (default is $PWD/udb.yaml)")
RootCmd.Flags().BoolVarP(&verbose, "verbose", "v", false,
"Verbose mode for debugging")
RootCmd.Flags().UintVarP(&logLevel, "logLevel", "l", 1,
"Level of debugging to display. 0 = info, 1 = debug, >1 = trace")
RootCmd.Flags().BoolVarP(&noTLS, "noTLS", "", false,
"Set to ignore TLS")
}
......@@ -127,6 +128,38 @@ func initConfig() {
// initLog initializes logging thresholds and the log path.
func initLog() {
vipLogLevel := viper.GetUint("logLevel")
// Check the level of logs to display
if vipLogLevel > 1 {
// Set the GRPC log level
if vipLogLevel > 1 {
err := os.Setenv("GRPC_GO_LOG_SEVERITY_LEVEL", "info")
if err != nil {
jww.ERROR.Printf("Could not set GRPC_GO_LOG_SEVERITY_LEVEL: %+v", err)
}
err = os.Setenv("GRPC_GO_LOG_VERBOSITY_LEVEL", "99")
if err != nil {
jww.ERROR.Printf("Could not set GRPC_GO_LOG_VERBOSITY_LEVEL: %+v", err)
}
}
// Turn on trace logs
jww.SetLogThreshold(jww.LevelTrace)
jww.SetStdoutThreshold(jww.LevelTrace)
mixmessages.TraceMode()
} else if vipLogLevel == 1 {
// Turn on debugging logs
jww.SetLogThreshold(jww.LevelDebug)
jww.SetStdoutThreshold(jww.LevelDebug)
mixmessages.DebugMode()
} else {
// Turn on info logs
jww.SetLogThreshold(jww.LevelInfo)
jww.SetStdoutThreshold(jww.LevelInfo)
}
if viper.Get("logPath") != nil {
// Create log file, overwrites if existing
logPath := viper.GetString("logPath")
......@@ -137,13 +170,4 @@ func initLog() {
udb.Log.SetLogOutput(logFile)
}
}
// If verbose flag set then log more info for debugging
if verbose || viper.GetBool("verbose") {
udb.Log.SetLogThreshold(jww.LevelDebug)
udb.Log.SetStdoutThreshold(jww.LevelDebug)
udb.Log.INFO.Print("Logging Verbosely")
} else {
udb.Log.SetLogThreshold(jww.LevelInfo)
udb.Log.SetStdoutThreshold(jww.LevelInfo)
}
}
......@@ -54,6 +54,11 @@ func StartBot(sess string, def *ndf.NetworkDefinition) error {
// Log into the server with a blank password
_, err = clientObj.Login("")
// API Settings (hard coded)
clientObj.DisableBlockingTransmission() // Deprecated
// Up to 10 messages per second
clientObj.SetRateLimiting(uint32(RateLimit))
if err != nil {
return err
}
......@@ -113,11 +118,6 @@ func Init(sessionFile string, regCode string, def *ndf.NetworkDefinition) (*id.U
return nil, initErr
}
// API Settings (hard coded)
clientObj.DisableBlockingTransmission() // Deprecated
// Up to 10 messages per second
clientObj.SetRateLimiting(uint32(RateLimit))
// connect udb to gateways
for {
err = clientObj.InitNetwork()
......
......@@ -3,21 +3,29 @@ module gitlab.com/elixxir/user-discovery-bot
go 1.13
require (
github.com/fsnotify/fsnotify v1.4.9 // indirect
github.com/go-pg/pg v8.0.6+incompatible
github.com/golang/protobuf v1.4.0 // indirect
github.com/jinzhu/inflection v1.0.0 // indirect
github.com/mattn/go-shellwords v1.0.10
github.com/mitchellh/go-homedir v1.1.0
github.com/mitchellh/mapstructure v1.2.2 // indirect
github.com/onsi/ginkgo v1.12.0 // indirect
github.com/onsi/gomega v1.9.0 // indirect
github.com/pelletier/go-toml v1.7.0 // indirect
github.com/pkg/errors v0.9.1
github.com/spf13/cobra v0.0.5
github.com/spf13/cobra v1.0.0
github.com/spf13/jwalterweatherman v1.1.0
github.com/spf13/viper v1.6.2
gitlab.com/elixxir/client v1.1.1-0.20200206231036-aa1e40f18ade
gitlab.com/elixxir/comms v0.0.0-20200206201144-aa6e356b3770
gitlab.com/elixxir/crypto v0.0.0-20200206203107-b8926242da23
gitlab.com/elixxir/primitives v0.0.0-20200207225613-9a4445ddec16
golang.org/x/crypto v0.0.0-20200207205829-a95e85b341fd // indirect
google.golang.org/genproto v0.0.0-20200207204624-4f3edf09f4f6 // indirect
github.com/spf13/viper v1.6.3
gitlab.com/elixxir/client v1.1.1-0.20200415211833-9216edbb5996
gitlab.com/elixxir/comms v0.0.0-20200415204952-6d63dd94a0ea
gitlab.com/elixxir/crypto v0.0.0-20200410231849-90e859940f5d
gitlab.com/elixxir/primitives v0.0.0-20200410231944-a57d71d577c9
golang.org/x/crypto v0.0.0-20200414173820-0848c9571904 // indirect
golang.org/x/net v0.0.0-20200324143707-d3edc9973b7e // indirect
golang.org/x/sys v0.0.0-20200413165638-669c56c373c4 // indirect
google.golang.org/genproto v0.0.0-20200413115906-b5235f65be36 // indirect
google.golang.org/grpc v1.28.1 // indirect
gopkg.in/ini.v1 v1.55.0 // indirect
mellium.im/sasl v0.2.1 // indirect
)
This diff is collapsed.
File deleted
......@@ -340,7 +340,7 @@ func TestRegisterListeners(t *testing.T) {
t.Errorf("Could not start message reciever: %v", err)
}
err = client.Logout()
err = client.Logout(time.Second)
if err != nil {
t.Errorf("Logout failed: %v", err)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment