forked from dmwm/dbs2go
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
41 lines (35 loc) · 832 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
// dbs2go - An example code how to write data-base based app
//
// Copyright (c) 2016 - Valentin Kuznetsov <vkuznet@gmail.com>
//
package main
import (
"flag"
"fmt"
"os"
"runtime"
"time"
"github.com/dmwm/dbs2go/web"
)
// version of the code
var gitVersion string
// Info function returns version string of the server
func info() string {
goVersion := runtime.Version()
tstamp := time.Now().Format("2006-02-01")
return fmt.Sprintf("dbs2go git=%s go=%s date=%s", gitVersion, goVersion, tstamp)
}
func main() {
var config string
flag.StringVar(&config, "config", "config.json", "dbs2go config file")
var version bool
flag.BoolVar(&version, "version", false, "Show version")
flag.Parse()
if version {
fmt.Println(info())
os.Exit(0)
}
web.GitVersion = gitVersion
web.ServerInfo = info()
web.Server(config)
}