-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
47 lines (39 loc) · 979 Bytes
/
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
package main
import (
"log"
"os"
"time"
)
var appDataPath string = "/opt/appdata/csdb/"
var dataPath string = "/opt/appdata/csdb/data"
var inboxPath string = "/opt/appdata/csdb/inbox"
var tmpPath string = "/tmp"
type cs struct {
UTC uint32
O uint32
H uint32
L uint32
C uint32
V uint32
OI uint32
}
func main() {
log.Printf("CSDB\n")
os.MkdirAll(appDataPath, os.ModePerm)
if !exists(appDataPath) {
appDataPath, _ = os.Getwd()
appDataPath += "/appdata/csdb/"
os.MkdirAll(appDataPath, os.ModePerm)
log.Printf("Failed to create required appdata directories in /opt/appdata. Switching to %s\n", appDataPath)
}
tmpPath = os.TempDir()
dataPath = appDataPath + "/data/"
inboxPath = appDataPath + "/inbox/"
os.MkdirAll(dataPath, os.ModePerm)
os.MkdirAll(inboxPath, os.ModePerm)
log.Println("Data Folder is ", appDataPath)
log.Println("Temp Folder is ", tmpPath)
time.LoadLocation("Asia/Kolkata")
processIncomingFiles()
startWebServer()
}