-
-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathconst.go
78 lines (63 loc) · 1.92 KB
/
const.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
package main
import (
"log"
"net/http"
)
const (
API_BASE_PATH = "/api/v1"
ADMIN_PASSWORD_SETTINGS_KEY = "ADMIN_PASSWORD"
session_secret_key = "SESSION_SECRET"
CORRELATION_API_SECRET_SETTINGS_KEY = "CORRELATION_API_KEY"
CHAINLOAD_URI_SETTINGS_KEY = "CHAINLOAD_URI"
PAGES_TO_COLLECT_SETTINGS_KEY = "PAGES_TO_COLLECT"
SEND_ALERTS_SETTINGS_KEY = "SEND_ALERTS"
csrf_header_name = "X-CSRF-Buster"
)
// var constant = make(map[string]string)
var is_postgres bool = get_env("DATABASE_URL") != ""
var pages_to_collect string
var chainload_uris string
var send_alerts bool
func get_host(request *http.Request) string {
host := get_env("DOMAIN")
if host == "" {
host = "https://" + request.Host
}
return host
}
func get_pages_to_collect() string {
return pages_to_collect
}
func set_pages_to_collect() {
pages_to_collect_value, err := db_single_item_query("SELECT value FROM settings WHERE key = $1", PAGES_TO_COLLECT_SETTINGS_KEY).toString()
if err != nil {
log.Fatal("Fatal Error on set page collect:", err)
}
pages_to_collect = "[" + pages_to_collect_value + "]"
}
func get_chainload_uri() string {
return chainload_uris
}
func set_chainload_uri() {
chainload_uris_value, err := db_single_item_query("SELECT value FROM settings WHERE key = $1", CHAINLOAD_URI_SETTINGS_KEY).toString()
if err != nil {
log.Fatal("Fatal Error on set chainload uri:", err)
}
chainload_uris = chainload_uris_value
}
func get_send_alerts() bool {
return send_alerts
}
func set_send_alerts() {
send_alerts_value, err := db_single_item_query("SELECT value FROM settings WHERE key = $1", SEND_ALERTS_SETTINGS_KEY).toBool()
if err != nil {
log.Fatal("Fatal Error on set alert:", err)
}
send_alerts = send_alerts_value
}
func get_screenshot_directory() string {
return "./screenshots"
}
func get_sqlite_database_path() string {
return "./db/xsshunter-go.db"
}