package env import ( "google.golang.org/grpc" "google.golang.org/grpc/credentials/insecure" "net/http" "ngs/serialize" "ngs/serialize/protobuf" "time" ) var ( Wd string // working path Die chan bool // wait for end application Heartbeat time.Duration // Heartbeat internal CheckOrigin func(*http.Request) bool // check origin when websocket enabled Debug bool // enable Debug WSPath string // WebSocket path(eg: ws://127.0.0.1/WSPath) HandshakeValidator func([]byte) error // When you need to verify the custom data of the handshake request // TimerPrecision indicates the precision of timer, default is time.Second TimerPrecision = time.Second // GlobalTicker represents global ticker that all cron job will be executed // in globalTicker. GlobalTicker *time.Ticker Serializer serialize.Serializer GrpcOptions = []grpc.DialOption{grpc.WithTransportCredentials(insecure.NewCredentials())} ) func init() { Die = make(chan bool) Heartbeat = 30 * time.Second Debug = false CheckOrigin = func(_ *http.Request) bool { return true } HandshakeValidator = func(_ []byte) error { return nil } Serializer = protobuf.NewSerializer() }