-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmain.go
executable file
·37 lines (29 loc) · 1.07 KB
/
main.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
//`which go` run $0 $@; exit $?;
package main
import (
"adguardhome/infra"
_ "adguardhome/infra/recipes/provision/adguardhome"
_ "adguardhome/infra/recipes/provision/caddy"
_ "adguardhome/infra/recipes/provision/fail2ban"
_ "adguardhome/infra/recipes/provision/generic"
_ "adguardhome/infra/recipes/provision/supervisor"
_ "adguardhome/infra/recipes/provision/ufw"
"fmt"
"github.com/go-exec/exec"
"time"
)
func main() {
exec.Task("onStart", func() {
exec.Set("startTime", time.Now())
infra.Config.Load(exec.GetOption("config").String())
}).Private()
exec.Task("onEnd", func() {
exec.Println(fmt.Sprintf("Finished in %s!`", time.Now().Sub(exec.Get("startTime").Time()).String()))
infra.Config.Dump(exec.GetOption("config").String())
}).Private()
configOpt := exec.NewOption("config", "Configuration file")
configOpt.Default = "./config.json"
exec.AddOption(configOpt)
exec.TaskGroup("build:infra", "servers:setup", "provision:generic", "provision:ufw", "provision:fail2ban", "provision:supervisor", "provision:adguardhome", "provision:caddy")
exec.Init()
}