fix:增加config属性
1、能自定义是否在启动前检查网络 2、增加demo模式
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package Util
|
||||
|
||||
import (
|
||||
"Mmx/Global"
|
||||
"Mmx/Modles"
|
||||
"fmt"
|
||||
"os"
|
||||
@@ -55,6 +56,8 @@ func (a *config) Init() *Modles.LoginInfo {
|
||||
os.Exit(3)
|
||||
}
|
||||
|
||||
Global.Config = &c
|
||||
|
||||
return a.Generate(
|
||||
&c.From,
|
||||
&c.Meta,
|
||||
|
||||
13
Util/util.go
13
Util/util.go
@@ -1,11 +1,13 @@
|
||||
package Util
|
||||
|
||||
import (
|
||||
"Mmx/Global"
|
||||
"crypto/md5"
|
||||
"crypto/sha1"
|
||||
"errors"
|
||||
"fmt"
|
||||
"io"
|
||||
"os"
|
||||
"regexp"
|
||||
)
|
||||
|
||||
@@ -45,3 +47,14 @@ func Sha1(content string) string {
|
||||
bs := h.Sum(nil)
|
||||
return fmt.Sprintf("%x\n", bs)
|
||||
}
|
||||
|
||||
func ErrHandler(err error) {
|
||||
if err != nil {
|
||||
fmt.Println("Error occurred")
|
||||
if Global.Config.Settings.DemoMode {
|
||||
panic(err)
|
||||
}
|
||||
fmt.Println(err)
|
||||
os.Exit(3)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user