/
geto.go
38 lines (32 loc) · 834 Bytes
/
geto.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
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
/*
Geto's main package
Parse command line arguments and let the fun begin!
*/
package main
import (
"flag"
"github.com/bgmerrell/geto/lib/config"
"github.com/bgmerrell/geto/server"
"os"
)
/* Variables set by command line parsing */
var configPath string
func parseCommandLine() {
/* TODO: look for a system-wide config file in a portable manner */
flag.StringVar(&configPath, "config-path", "geto.ini", "Configuration file path")
flag.Parse()
}
func main() {
parseCommandLine()
if _, err := config.ParseConfig(configPath); err != nil {
os.Exit(1)
}
if server.Serve() {
os.Exit(0)
} else {
os.Exit(1)
}
}