32 lines
480 B
Go
32 lines
480 B
Go
package main
|
|
|
|
import (
|
|
"fmt"
|
|
"log"
|
|
|
|
"git.trj.tw/golang/go-file-serve/module/config"
|
|
"git.trj.tw/golang/go-file-serve/module/flags"
|
|
"git.trj.tw/golang/go-file-serve/routes"
|
|
)
|
|
|
|
func init() {
|
|
flags.RegFlags()
|
|
}
|
|
|
|
func main() {
|
|
var err error
|
|
|
|
flag := flags.GetFlags()
|
|
|
|
err = config.LoadConfig(flag.ConfigPath)
|
|
if err != nil {
|
|
log.Fatal(err)
|
|
}
|
|
conf := config.GetConf()
|
|
|
|
engine := routes.NewEngine()
|
|
routes.SetRoutes(engine)
|
|
|
|
engine.Run(fmt.Sprintf(":%d", conf.Port))
|
|
}
|