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 @@ -73,6 +73,20 @@ func init() {
73
73
// open levelDB connections
74
74
openLevelDBConnections ()
75
75
76
+ if common .CookiePath != "" {
77
+ data , err := os .ReadFile (common .CookiePath )
78
+ if err != nil {
79
+ panic (err )
80
+ }
81
+
82
+ credentials := strings .Split (string (data ), ":" )
83
+ if len (credentials ) != 2 {
84
+ panic ("cookie file is invalid" )
85
+ }
86
+ common .RpcUser = credentials [0 ]
87
+ common .RpcPass = credentials [1 ]
88
+ }
89
+
76
90
if common .RpcUser == "" {
77
91
panic ("rpc user not set" ) // todo use cookie file to circumvent this requirement
78
92
}
You can’t perform that action at this time.
0 commit comments