54 lines
1.3 KiB
Go
54 lines
1.3 KiB
Go
package q5
|
|
|
|
import (
|
|
"os"
|
|
"fmt"
|
|
"bufio"
|
|
)
|
|
|
|
var optDebug = ""
|
|
var _optDebug = false
|
|
var _optTimeZone int64 = 8
|
|
var q5JsonConfData = ""
|
|
var q5JsonConf *XObject
|
|
var initLines []string
|
|
|
|
func init() {
|
|
initLines = make([]string, 0)
|
|
if optDebug != "" {
|
|
_optDebug = true
|
|
}
|
|
initLines = append(initLines, fmt.Sprintf("optDebug %s _optDebug:%t", optDebug, _optDebug))
|
|
confName := "q5.json"
|
|
if Debug() {
|
|
confName = "q5.debug.json"
|
|
}
|
|
if f, err := os.Open(confName); err == nil {
|
|
defer f.Close()
|
|
q5JsonConfData, _ = bufio.NewReader(f).ReadString(0)
|
|
q5JsonConf = NewXoFromJsonStr(q5JsonConfData)
|
|
if q5JsonConf.HasKey("timeZone") {
|
|
_optTimeZone = q5JsonConf.At("timeZone").AsXValue().GetInt64()
|
|
if _optTimeZone < 1 || _optTimeZone > 24 {
|
|
panic(confName +
|
|
" timeZone error val:" +
|
|
NewXInt64(_optTimeZone).GetString())
|
|
}
|
|
}
|
|
initLines = append(initLines, fmt.Sprintf("%s data:%s", confName, q5JsonConfData))
|
|
initLines = append(initLines, fmt.Sprintf("%s json:%s", confName, q5JsonConf.ToJsonStr()))
|
|
} else {
|
|
initLines = append(initLines, fmt.Sprintf("%s not found", confName))
|
|
}
|
|
initLines = append(initLines, fmt.Sprintf("_optTimeZone:%d", _optTimeZone))
|
|
/*if Debug() {
|
|
for _, val := range initLines {
|
|
fmt.Println(val)
|
|
}
|
|
}*/
|
|
}
|
|
|
|
func GetInitLogs() []string {
|
|
return initLines
|
|
}
|