package main

import (
	"chathub/chfoot/core"
	"chathub/chfoot/http"
	"flag"
	"fmt"
	"github.com/etlibgo/et"
	"time"
)

func main() {
	fmt.Println("foot began")

	fmt.Println(et.StrPadLeft("et pad left", "0", 20))

	pStrCfgPath := flag.String("cfgpath", "foot-cfg/foot_main.cfg", "see foot-cfg")
	flag.Parse()

	strCfgContent := et.FileReadStr(*pStrCfgPath)
	pJsonCfg := et.ExJsonFromStr(strCfgContent)
	core.AppInit(pJsonCfg)

	http.FootHttpEntry(core.AppGetHttpServer())

	fmt.Println("cfg get name:" + core.CfgGetStr("name"))
	core.AppStart()

	for core.AppIsRunning() {
		time.Sleep(time.Duration(100) * time.Millisecond)
	}

	fmt.Println("foot ended")
}
