@@ -17,64 +17,10 @@ limitations under the License.
17
17
package core
18
18
19
19
import (
20
- "flag"
21
- "fmt"
22
- "runtime"
23
- "strings"
24
-
25
20
"github.com/op/go-logging"
26
21
"github.com/spf13/viper"
27
22
)
28
23
29
- // Config the config wrapper structure
30
- type Config struct {
31
- }
32
-
33
- func init () {
34
-
35
- }
36
-
37
- // SetupTestLogging setup the logging during test execution
38
- func SetupTestLogging () {
39
- level , err := logging .LogLevel (viper .GetString ("peer.logging.level" ))
40
- if err == nil {
41
- // No error, use the setting
42
- logging .SetLevel (level , "main" )
43
- logging .SetLevel (level , "server" )
44
- logging .SetLevel (level , "peer" )
45
- } else {
46
- log .Warningf ("Log level not recognized '%s', defaulting to %s: %s" , viper .GetString ("peer.logging.level" ), logging .ERROR , err )
47
- logging .SetLevel (logging .ERROR , "main" )
48
- logging .SetLevel (logging .ERROR , "server" )
49
- logging .SetLevel (logging .ERROR , "peer" )
50
- }
51
- }
52
-
53
- // SetupTestConfig setup the config during test execution
54
- func SetupTestConfig () {
55
- flag .Parse ()
56
-
57
- // Now set the configuration file
58
- viper .SetEnvPrefix ("HYPERLEDGER" )
59
- viper .AutomaticEnv ()
60
- replacer := strings .NewReplacer ("." , "_" )
61
- viper .SetEnvKeyReplacer (replacer )
62
- viper .SetConfigName ("core" ) // name of config file (without extension)
63
- viper .AddConfigPath ("./" ) // path to look for the config file in
64
- viper .AddConfigPath ("./../" ) // path to look for the config file in
65
- err := viper .ReadInConfig () // Find and read the config file
66
- if err != nil { // Handle errors reading the config file
67
- panic (fmt .Errorf ("Fatal error config file: %s \n " , err ))
68
- }
69
-
70
- SetupTestLogging ()
71
-
72
- // Set the number of maxprocs
73
- var numProcsDesired = viper .GetInt ("peer.gomaxprocs" )
74
- log .Debugf ("setting Number of procs to %d, was %d\n " , numProcsDesired , runtime .GOMAXPROCS (2 ))
75
-
76
- }
77
-
78
24
// See fabric/core/peer/config.go for comments on the configuration caching
79
25
// methodology.
80
26
0 commit comments