This commit is contained in:
YouROK
2020-11-30 23:32:51 +03:00
parent 0569ade7b8
commit ee7902cbb6
5 changed files with 13 additions and 12 deletions

View File

@@ -10,6 +10,8 @@ import (
"github.com/alexflint/go-arg" "github.com/alexflint/go-arg"
"server" "server"
"server/log"
"server/settings"
"server/version" "server/version"
) )
@@ -41,11 +43,11 @@ func main() {
if params.Add != "" { if params.Add != "" {
add() add()
} }
settings.Path = params.Path
Preconfig(params.DontKill) Preconfig(params.DontKill)
server.Start(params.Path, params.Port, params.RDB) server.Start(params.Port, params.RDB)
fmt.Println(server.WaitServer()) log.TLogln(server.WaitServer())
time.Sleep(time.Second * 3) time.Sleep(time.Second * 3)
os.Exit(0) os.Exit(0)
} }

View File

@@ -5,8 +5,8 @@ import (
"server/web" "server/web"
) )
func Start(settingsPath, port string, roSets bool) { func Start(port string, roSets bool) {
settings.InitSets(settingsPath, roSets) settings.InitSets(roSets)
if port == "" { if port == "" {
port = "8090" port = "8090"
} }

View File

@@ -14,8 +14,8 @@ type TDB struct {
db *bolt.DB db *bolt.DB
} }
func NewTDB(path string, readOnly bool) *TDB { func NewTDB(readOnly bool) *TDB {
db, err := bolt.Open(filepath.Join(path, "config.db"), 0666, nil) db, err := bolt.Open(filepath.Join(Path, "config.db"), 0666, nil)
if err != nil { if err != nil {
log.TLogln(err) log.TLogln(err)
return nil return nil
@@ -23,7 +23,7 @@ func NewTDB(path string, readOnly bool) *TDB {
tdb := new(TDB) tdb := new(TDB)
tdb.db = db tdb.db = db
tdb.Path = path tdb.Path = Path
tdb.ReadOnly = readOnly tdb.ReadOnly = readOnly
return tdb return tdb
} }

View File

@@ -5,9 +5,8 @@ var (
Path string Path string
) )
func InitSets(path string, readOnly bool) { func InitSets(readOnly bool) {
Path = path tdb = NewTDB(readOnly)
tdb = NewTDB(path, readOnly)
loadBTSets() loadBTSets()
} }

View File

@@ -1,4 +1,4 @@
package version package version
const Version = "1.2.78_" const Version = "1.2.78_1"
const VerInt = 78 const VerInt = 78