-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
41 lines (32 loc) · 848 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
package main
import (
"runtime"
"os"
"fmt"
"github.com/kobehaha/mysql-proxy/config"
"github.com/kobehaha/mysql-proxy/mysql-proxy"
"github.com/kobehaha/mysql-proxy/log"
)
var VERSION = 1.0
var buildstamp = "no timestamp set"
func main() {
runtime.GOMAXPROCS(runtime.NumCPU())
var configFile string
if len(os.Args) == 2 {
configFile = os.Args[1]
} else{
fmt.Printf("CMD eg: mysql-proxy config.json, version: %s, buildstamp: %s\n", VERSION, buildstamp)
os.Exit(1)
}
// ParseConfig
cfg, err := config.ParseConfigFile(configFile)
if err != nil {
fmt.Println("parse config file error")
}
log.Init(cfg)
server, err := mysql.NewServer(cfg)
if err != nil {
log.GetLogger().Error("server start error %s", err)
}
server.Start()
}