fix:增加config属性

1、能自定义是否在启动前检查网络
2、增加demo模式
This commit is contained in:
Mmx
2021-03-17 17:59:31 +08:00
parent cbc0d562aa
commit 39bbc30d9c
5 changed files with 43 additions and 22 deletions

View File

@@ -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,

View File

@@ -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)
}
}