File tree Expand file tree Collapse file tree 4 files changed +20
-2
lines changed Expand file tree Collapse file tree 4 files changed +20
-2
lines changed Original file line number Diff line number Diff line change @@ -5,11 +5,13 @@ host = "127.0.0.1:8000"
5
5
# (defaults to http://127.0.0.1:8332)
6
6
rpc_endpoint = " http://127.0.0.1:18443"
7
7
8
+ # required, unless rpc_user and rpc_pass are set
9
+ cookie_path = " "
8
10
9
- # required
11
+ # required, unless cookie_path is set
10
12
rpc_pass = " your-rpc-password"
11
13
12
- # required
14
+ # required, unless cookie_path is set
13
15
rpc_user = " your-rpc-user"
14
16
15
17
# required (has to be >= 1)
Original file line number Diff line number Diff line change @@ -29,6 +29,7 @@ func LoadConfigs(pathToConfig string) {
29
29
MaxParallelTweakComputations = viper .GetInt ("max_parallel_tweak_computations" )
30
30
31
31
RpcEndpoint = viper .GetString ("rpc_endpoint" )
32
+ CookiePath = viper .GetString ("cookie_path" )
32
33
RpcPass = viper .GetString ("rpc_pass" )
33
34
RpcUser = viper .GetString ("rpc_user" )
34
35
Original file line number Diff line number Diff line change @@ -12,6 +12,7 @@ var TweaksOnly bool
12
12
13
13
var (
14
14
RpcEndpoint = "http://127.0.0.1:8332" // default local node
15
+ CookiePath = ""
15
16
RpcUser = ""
16
17
RpcPass = ""
17
18
Original file line number Diff line number Diff line change @@ -74,6 +74,20 @@ func init() {
74
74
// open levelDB connections
75
75
openLevelDBConnections ()
76
76
77
+ if common .CookiePath != "" {
78
+ data , err := os .ReadFile (common .CookiePath )
79
+ if err != nil {
80
+ panic (err )
81
+ }
82
+
83
+ credentials := strings .Split (string (data ), ":" )
84
+ if len (credentials ) != 2 {
85
+ panic ("cookie file is invalid" )
86
+ }
87
+ common .RpcUser = credentials [0 ]
88
+ common .RpcPass = credentials [1 ]
89
+ }
90
+
77
91
if common .RpcUser == "" {
78
92
panic ("rpc user not set" )
79
93
}
You can’t perform that action at this time.
0 commit comments