-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathmain.go
40 lines (32 loc) · 993 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
package main
import (
"os"
"strconv"
"github.com/dev-saw99/deko/compiler"
"github.com/dev-saw99/deko/handler"
"github.com/dev-saw99/deko/router"
"github.com/dev-saw99/deko/utils"
constants "github.com/dev-saw99/deko/utils/constant"
)
func main() {
utils.InitializeLogger(constants.DEKO_LOG_FILE)
utils.Logger.Infow("Starting Deko Server")
isSandboxEnv, err := strconv.ParseBool(os.Getenv("SANDBOX_ENV"))
if err != nil {
utils.Logger.Infow("SANDBOX_ENV env variable not found, setting isSandboxEnv to False")
isSandboxEnv = false
}
var compilerDNS string
if isSandboxEnv {
compilerDNS = constants.DEKO_BRIDGE_SANDBOX_CONTAINER_HOST_PORT
} else {
compilerDNS = constants.DEKO_BRIDGE_LOCALHOST_CONTAINER_HOST_PORT
}
handler.CompilerClient = compiler.NewCompiler(compilerDNS)
utils.Logger.Infow("Initialising Compiler Client")
handler.CompilerClient.Init()
utils.Logger.Infow("Creating New Router",
"port", ":9000")
r := router.NewRouter()
r.Run(":9000")
}