-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathwebserver-interface.go
62 lines (40 loc) · 1.91 KB
/
webserver-interface.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
// jeffCoin 5. WEBSERVER webserver-interface.go
package webserver
import (
"encoding/json"
log "github.com/sirupsen/logrus"
)
// PASWORD ***************************************************************************************************************
// GetPassword - Gets the Password
func GetPassword() passwordStruct {
s := "START GetPassword() - Gets the Password"
log.Debug("WEBSERVER: I/F " + s)
thePassword := getPassword()
s = "END GetPassword() - Gets the Password"
log.Debug("WEBSERVER: I/F " + s)
return thePassword
}
// WritePasswordFile - Writes the password hash to a file and puts in struct
func WritePasswordFile(nodeName string, passwordString string) {
s := "START WritePasswordFile() - Writes the password hash to a file and puts in struct"
log.Debug("WEBSERVER: I/F " + s)
thePassword := writePasswordFile(nodeName, passwordString)
s = "Congrats, you created your password hash (-loglevel trace to display)"
log.Info("WEBSERVER: I/F " + s)
js, _ := json.MarshalIndent(thePassword, "", " ")
log.Trace("\n\n" + string(js) + "\n\n")
s = "END WritePasswordFile() - Writes the password hash to a file and puts in struct"
log.Debug("WEBSERVER: I/F " + s)
}
// ReadPasswordFile - Reads the password hash from a file and puts in struct
func ReadPasswordFile(nodeName string, passwordString string) {
s := "START ReadPasswordFile() - Reads the password hash from a file and puts in struct"
log.Debug("WEBSERVER: I/F " + s)
thePassword := readPasswordFile(nodeName, passwordString)
s = "Congrats, you loaded your password hash from a file (-loglevel trace to display)"
log.Info("WEBSERVER: I/F " + s)
js, _ := json.MarshalIndent(thePassword, "", " ")
log.Trace("\n\n" + string(js) + "\n\n")
s = "END ReadPasswordFile() - Reads the password hash from a file and puts in struct"
log.Debug("WEBSERVER: I/F " + s)
}