1234567891011121314151617181920212223242526272829303132333435363738394041424344454647 |
- package main
- import (
- "fmt"
- "log"
- "git.ali33.ru/fcg-xvii/go-tools/text/config"
- _ "git.ali33.ru/fcg-xvii/go-tools/text/config/ini"
- "git.ali33.ru/fcg-xvii/net/v3/http/server"
- )
- var (
- listen = "127.0.0.1:33775"
- debugMode = false
- downTime = 5
- )
- func main() {
- appConf, err := config.FromFile("ini", "config.ini")
- if err == nil {
- listen = appConf.ValueDefault("listen", listen).(string)
- debugMode = appConf.ValueDefault("debug_mode", debugMode).(bool)
- downTime = appConf.ValueDefault("downtime", downTime).(int)
- }
- log.Println("listen", listen)
- log.Println("debug_mode", debugMode)
- log.Println("downtime", downTime)
- if !debugMode {
- openURI(fmt.Sprintf("http://%s", listen))
- }
- // запуск сервера
- conf := server.ConfigDefault()
- conf.Addr = listen
- conf.App = NewApplication(listen)
- serv := server.NewServerHTTP(conf)
- go serv.Start(func(s server.Server, started bool, err error) {
- log.Println(s, started, err)
- })
- mainChan := make(chan struct{})
- <-mainChan
- }
|