-
Notifications
You must be signed in to change notification settings - Fork 1
/
main.go
80 lines (71 loc) · 2.04 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
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
package main
import (
"fmt"
"github.com/gorilla/handlers"
"log"
"net/http"
"rmtly-server/application/applicationUtils"
"rmtly-server/config/interfaces"
configService "rmtly-server/config/services"
"rmtly-server/routers"
"time"
)
// _ _
// | | | |
// _ __ _ __ ___ | |_| |_ _ ______ ___ ___ _ ____ _____ _ __
// | '__| '_ ` _ \| __| | | | |______/ __|/ _ \ '__\ \ / / _ \ '__|
// | | | | | | | | |_| | |_| | \__ \ __/ | \ V / __/ |
// |_| |_| |_| |_|\__|_|\__, | |___/\___|_| \_/ \___|_|
// __/ |
// |___/
func main() {
showBranding()
startInit()
config := configService.GetConfig()
startServer(config)
}
func startInit() {
applicationUtils.InitIconUtils()
configService.InitConfig()
}
func startServer(config interfaces.Config) {
router := routers.RootRouter()
handler := handlers.CORS(
handlers.AllowedHeaders([]string{
"Accept",
"Accept-Language",
"Content-Type",
"Content-Language",
"Origin",
}),
)(router)
server := &http.Server{
Addr: config.Network.Address,
Handler: handler,
TLSConfig: nil,
ReadTimeout: 0,
ReadHeaderTimeout: time.Second * 150,
WriteTimeout: time.Second * 150,
IdleTimeout: time.Second * 60,
MaxHeaderBytes: 0,
TLSNextProto: nil,
ConnState: nil,
ErrorLog: nil,
BaseContext: nil,
ConnContext: nil,
}
if err := server.ListenAndServe(); err != nil {
log.Fatal(err)
}
}
func showBranding() {
fmt.Println("// _ _\n"+
"// | | | |\n"+
"// _ __ _ __ ___ | |_| |_ _ ______ ___ ___ _ ____ _____ _ __\n"+
"// | '__| '_ ` _ \\| __| | | | |______/ __|/ _ \\ '__\\ \\ / / _ \\ '__|\n"+
"// | | | | | | | | |_| | |_| | \\__ \\ __/ | \\ V / __/ |\n"+
"// |_| |_| |_| |_|\\__|_|\\__, | |___/\\___|_| \\_/ \\___|_|\n"+
"// __/ |\n"+
"// |___/\n",
"rmtly-server running...")
}