mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-10 01:01:56 +00:00
load dotenv file
This commit is contained in:
parent
2365ccb5d8
commit
39fa0ef810
|
@ -7,6 +7,7 @@ import (
|
||||||
"os/signal"
|
"os/signal"
|
||||||
"runtime"
|
"runtime"
|
||||||
|
|
||||||
|
"github.com/joho/godotenv"
|
||||||
"github.com/zserge/lorca"
|
"github.com/zserge/lorca"
|
||||||
|
|
||||||
log "github.com/sirupsen/logrus"
|
log "github.com/sirupsen/logrus"
|
||||||
|
@ -17,6 +18,12 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
dotenvFile := ".env.local"
|
||||||
|
if err := godotenv.Load(dotenvFile); err != nil {
|
||||||
|
log.WithError(err).Error("error loading dotenv file")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
var args []string
|
var args []string
|
||||||
if runtime.GOOS == "linux" {
|
if runtime.GOOS == "linux" {
|
||||||
args = append(args, "--class=bbgo")
|
args = append(args, "--class=bbgo")
|
||||||
|
@ -46,7 +53,7 @@ func main() {
|
||||||
// TODO: load the loading page html
|
// TODO: load the loading page html
|
||||||
|
|
||||||
// find a free port for binding the server
|
// find a free port for binding the server
|
||||||
ln, err := net.Listen("tcp", "127.0.0.1:9999")
|
ln, err := net.Listen("tcp", "127.0.0.1:0")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.WithError(err).Error("can not bind listener")
|
log.WithError(err).Error("can not bind listener")
|
||||||
return
|
return
|
||||||
|
|
Loading…
Reference in New Issue
Block a user