2018-05-17 18:35:53 +03:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"os"
|
|
|
|
|
|
|
|
"github.com/jessevdk/go-flags"
|
2018-05-31 15:03:57 +03:00
|
|
|
|
|
|
|
"github.com/op/go-logging"
|
2018-05-17 18:35:53 +03:00
|
|
|
)
|
|
|
|
|
|
|
|
// Options struct
|
|
|
|
type Options struct {
|
|
|
|
Config string `short:"c" long:"config" default:"config.yml" description:"Path to configuration file"`
|
|
|
|
}
|
|
|
|
|
2018-05-31 15:03:57 +03:00
|
|
|
var (
|
2018-08-14 17:49:01 +03:00
|
|
|
config *TransportConfig
|
|
|
|
orm *Orm
|
|
|
|
logger *logging.Logger
|
|
|
|
options Options
|
|
|
|
parser = flags.NewParser(&options, flags.Default)
|
|
|
|
tokenCounter uint32
|
2018-05-31 15:03:57 +03:00
|
|
|
)
|
2018-05-17 18:35:53 +03:00
|
|
|
|
|
|
|
func main() {
|
|
|
|
if _, err := parser.Parse(); err != nil {
|
|
|
|
if flagsErr, ok := err.(*flags.Error); ok && flagsErr.Type == flags.ErrHelp {
|
|
|
|
os.Exit(0)
|
|
|
|
} else {
|
|
|
|
os.Exit(1)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|