forked from statping/statping
-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.go
86 lines (78 loc) · 1.52 KB
/
setup.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
78
79
80
81
82
83
84
85
86
package core
import (
"fmt"
"github.com/hunterlong/statup/utils"
"os"
)
func InsertDefaultComms() {
emailer := &Communication{
Method: "email",
Removable: false,
Enabled: false,
}
Create(emailer)
}
func DeleteConfig() {
err := os.Remove("./config.yml")
if err != nil {
utils.Log(3, err)
}
}
type ErrorResponse struct {
Error string
}
func LoadSampleData() error {
fmt.Println("Inserting Sample Data...")
s1 := &Service{
Name: "Google",
Domain: "https://google.com",
ExpectedStatus: 200,
Interval: 10,
Port: 0,
Type: "https",
Method: "GET",
}
s2 := &Service{
Name: "Statup.io",
Domain: "https://statup.io",
ExpectedStatus: 200,
Interval: 15,
Port: 0,
Type: "https",
Method: "GET",
}
s3 := &Service{
Name: "Statup.io SSL Check",
Domain: "https://statup.io",
ExpectedStatus: 200,
Interval: 15,
Port: 443,
Type: "tcp",
}
s4 := &Service{
Name: "Github Failing Check",
Domain: "https://github.com/thisisnotausernamemaybeitis",
ExpectedStatus: 200,
Interval: 15,
Port: 0,
Type: "https",
Method: "GET",
}
s1.Create()
s2.Create()
s3.Create()
s4.Create()
checkin := &Checkin{
Service: s2.Id,
Interval: 30,
Api: utils.NewSHA1Hash(18),
}
checkin.Create()
for i := 0; i < 20; i++ {
s1.Check()
s2.Check()
s3.Check()
s4.Check()
}
return nil
}