-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathcliMain.go
77 lines (67 loc) · 2.14 KB
/
cliMain.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
// .
//
// CLI Flags
//
// Enterprise-wallet when launched via CLI has various launch options, see:
// enterprise-wallet -h
package main
import (
"bufio"
"flag"
"fmt"
"os"
"os/signal"
"syscall"
"time"
)
var (
ADD_RANDOM_ADDRESSES = false // Add random addresses. Makes it easier for testing
)
func main() {
// configure the server
var (
guiDB = flag.String("guiDB", "Bolt", "GUI Database: Bolt, LDB, or Map")
walDB = flag.String("walDB", "Bolt", "Wallet Database: Bolt, LDB, Map, or ENC")
txDB = flag.String("txDB", "Bolt", "Transaction Database: Bolt, LDB, or Map")
port = flag.Int("port", 8091, "The port for the GUIWallet")
compiled = flag.Bool("compiled", true, "Decides wheter to use the compiled statics or not. Useful for modifying")
randomAdds = flag.Bool("randadd", true, "Overrides ADD_RANDOM_ADDRESSES if false and does not add random addresses")
v1Import = flag.Bool("i", true, "Search for M1 wallet, if there is no M2 wallet file")
v1Path = flag.String("v1path", "/.factom/factoid_wallet_bolt.db", "Change the path for V1 import")
factomdLocation = flag.String("factomdlocation", "", "Change the location of factomd. Default comes from the config file")
min = flag.Bool("min", false, "Temporary flag, for testing")
balup = flag.Int64("balup", 10000, "Changes how often the balances of addresses are updated in the cache. Value is in MillSeconds")
)
flag.Parse()
c := make(chan os.Signal, 2)
signal.Notify(c, os.Interrupt, syscall.SIGTERM)
go func() {
<-c
close()
os.Exit(1)
}()
if !(*compiled) {
COMPILED_STATICS = false
}
if *balup != 10000 {
BALANCE_UPDATE_INTERVAL = time.Duration(*balup) * time.Millisecond
}
if *walDB == "Map" {
if *randomAdds {
ADD_RANDOM_ADDRESSES = true
} else {
ADD_RANDOM_ADDRESSES = false
}
}
if *min {
FILES_PATH += "min-"
}
password := ""
if *walDB == "ENC" {
reader := bufio.NewReader(os.Stdin)
fmt.Println("Enter password: ")
text, _, _ := reader.ReadLine()
password = string(text)
}
InitiateWalletAndWeb(*guiDB, *walDB, *txDB, *port, *v1Import, *v1Path, *factomdLocation, password)
}