You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
lal/app/lalserver/main.go

51 lines
1.1 KiB
Go

// Copyright 2019, Chef. All rights reserved.
// https://github.com/q191201771/lal
//
// Use of this source code is governed by a MIT-style license
// that can be found in the License file.
//
// Author: Chef (191201771@qq.com)
package main
import (
"flag"
"fmt"
"github.com/q191201771/naza/pkg/nazalog"
"os"
"github.com/q191201771/lal/pkg/base"
"github.com/q191201771/lal/pkg/logic"
"github.com/q191201771/naza/pkg/bininfo"
)
func main() {
defer nazalog.Sync()
confFilename := parseFlag()
lals := logic.NewLalServer(func(option *logic.Option) {
option.ConfFilename = confFilename
})
err := lals.RunLoop()
nazalog.Infof("lal server loop done. err=%+v", err)
}
func parseFlag() string {
binInfoFlag := flag.Bool("v", false, "show bin info")
cf := flag.String("c", "", "specify conf file")
p := flag.String("p", "", "specify current work directory")
flag.Parse()
if *binInfoFlag {
_, _ = fmt.Fprint(os.Stderr, bininfo.StringifyMultiLine())
_, _ = fmt.Fprintln(os.Stderr, base.LalFullInfo)
os.Exit(0)
}
if *p != "" {
os.Chdir(*p)
}
return *cf
}