File tree 3 files changed +39
-12
lines changed
3 files changed +39
-12
lines changed Original file line number Diff line number Diff line change @@ -14,16 +14,11 @@ fetch_bindings:
14
14
install_razor :
15
15
@echo " Installing razor node...."
16
16
${GO} build -o ./build/bin/razor main.go
17
- @echo " Razor node installed. \n"
17
+ @echo " Razor node installed."
18
+ @echo " "
18
19
19
20
set_config :
20
- @echo " Enter provider: " ; \
21
- read PROVIDER; \
22
- echo " Enter gas multiplier value: " ; \
23
- read GAS_MULTIPLIER; \
24
- echo " Enter buffer percent: " ; \
25
- read BUFFER_PERCENT; \
26
- echo "\n"; \
27
- echo "Setting initial config..."; \
28
- ${RAZOR} setconfig -p $${PROVIDER} -g $${GAS_MULTIPLIER} -b $${BUFFER_PERCENT}
29
- @echo "Setup done"
21
+ @echo " Setup initial config"
22
+ @${SHELL} config.sh
23
+ @echo " "
24
+ @echo " Razor node is set up and ready to use"
Original file line number Diff line number Diff line change 1
1
package cmd
2
2
3
3
import (
4
+ log "github.com/sirupsen/logrus"
4
5
"github.com/spf13/cobra"
5
6
"github.com/spf13/viper"
6
- "log"
7
7
"razor/utils"
8
8
)
9
9
@@ -26,6 +26,12 @@ Setting the gas multiplier value enables the CLI to multiply the gas with that v
26
26
if bufferPercent != 0 {
27
27
viper .Set ("buffer" , bufferPercent )
28
28
}
29
+ if provider == "" && gasMultiplier == - 1 && bufferPercent == 0 {
30
+ viper .Set ("provider" , "http://127.0.0.1:8545" )
31
+ viper .Set ("gasmultiplier" , 1.0 )
32
+ viper .Set ("buffer" , 30 )
33
+ log .Info ("Config values set to default. Use setconfig to modify the values." )
34
+ }
29
35
path := utils .GetDefaultPath () + "/razor.yaml"
30
36
err := viper .WriteConfigAs (path )
31
37
if err != nil {
Original file line number Diff line number Diff line change
1
+ #! /bin/bash
2
+
3
+ set -e -o pipefail
4
+
5
+ BIN_DIR=./build/bin
6
+ RAZOR=${BIN_DIR} /razor
7
+
8
+ read -rp " Provider: (http://127.0.0.1:8545) " PROVIDER
9
+ if [ -z " $PROVIDER " ];
10
+ then
11
+ PROVIDER=" http://127.0.0.1:8545"
12
+ fi
13
+
14
+ read -rp " Gas Multiplier: (1.0) " GASMULTIPLIER
15
+ if [ -z " $GASMULTIPLIER " ];
16
+ then
17
+ GASMULTIPLIER=1.0
18
+ fi
19
+
20
+ read -rp " Buffer Percent: (20) " BUFFER
21
+ if [ -z " $BUFFER " ];
22
+ then
23
+ BUFFER=20
24
+ fi
25
+
26
+ $RAZOR setconfig -p $PROVIDER -b $BUFFER -g $GASMULTIPLIER
You can’t perform that action at this time.
0 commit comments