diff --git a/core/config.go b/core/config.go index 9bf1feb9251..6f45bde4d57 100644 --- a/core/config.go +++ b/core/config.go @@ -17,64 +17,10 @@ limitations under the License. package core import ( - "flag" - "fmt" - "runtime" - "strings" - "github.com/op/go-logging" "github.com/spf13/viper" ) -// Config the config wrapper structure -type Config struct { -} - -func init() { - -} - -// SetupTestLogging setup the logging during test execution -func SetupTestLogging() { - level, err := logging.LogLevel(viper.GetString("peer.logging.level")) - if err == nil { - // No error, use the setting - logging.SetLevel(level, "main") - logging.SetLevel(level, "server") - logging.SetLevel(level, "peer") - } else { - log.Warningf("Log level not recognized '%s', defaulting to %s: %s", viper.GetString("peer.logging.level"), logging.ERROR, err) - logging.SetLevel(logging.ERROR, "main") - logging.SetLevel(logging.ERROR, "server") - logging.SetLevel(logging.ERROR, "peer") - } -} - -// SetupTestConfig setup the config during test execution -func SetupTestConfig() { - flag.Parse() - - // Now set the configuration file - viper.SetEnvPrefix("HYPERLEDGER") - viper.AutomaticEnv() - replacer := strings.NewReplacer(".", "_") - viper.SetEnvKeyReplacer(replacer) - viper.SetConfigName("core") // name of config file (without extension) - viper.AddConfigPath("./") // path to look for the config file in - viper.AddConfigPath("./../") // path to look for the config file in - err := viper.ReadInConfig() // Find and read the config file - if err != nil { // Handle errors reading the config file - panic(fmt.Errorf("Fatal error config file: %s \n", err)) - } - - SetupTestLogging() - - // Set the number of maxprocs - var numProcsDesired = viper.GetInt("peer.gomaxprocs") - log.Debugf("setting Number of procs to %d, was %d\n", numProcsDesired, runtime.GOMAXPROCS(2)) - -} - // See fabric/core/peer/config.go for comments on the configuration caching // methodology.