push host添加环境变量支持,环境变量值优先

This commit is contained in:
fish 2019-12-17 16:36:01 +08:00
parent fb6603b29c
commit b77bd47134
1 changed files with 12 additions and 2 deletions

View File

@ -3,7 +3,7 @@ package main
import (
"database/sql"
// "encoding/json"
"log"
"os"
// _ "github.com/mattn/go-sqlite3"
@ -182,9 +182,19 @@ func init() {
check(err)
}
//post_to_server smartoilets.host
// conf
var SMARTOILETS_HOST string
SMARTOILETS_HOST = os.Getenv("SMARTOILETS_HOST")
if SMARTOILETS_HOST != "" {
conf.POST_TO_SERVER = SMARTOILETS_HOST
}
// log.Println("conf:{}", conf.POST_TO_SERVER)
var device Device
log.Println("slaveDevices:", conf.WIRELESSSLAVEDEVICES)
// log.Println("slaveDevices:", conf.WIRELESSSLAVEDEVICES)
for _, v := range conf.LORANODES {
v.CURRENT_DATA = -1