pull/4/head
Leonid Maslakov 4 months ago
parent 1427cd9f8b
commit 0da49dcce9
  1. 12
      cmd/wallblog.go
  2. 8
      cmd/wallblog_run.go

@ -23,17 +23,12 @@ import (
"os"
)
func printVersion() {
println("1.3.0")
}
func printHelp() {
println("Usage:", os.Args[0], "[OPTION]...")
println("Lightweight blogging engine with markdown support.")
println("")
println("-config path to config file")
println("-help display this help and exit")
println("-version output version information and exit")
}
func main() {
@ -42,7 +37,6 @@ func main() {
flagConfig := flag.String("config", "/etc/wallblog/config.json", "")
flagHelp := flag.Bool("help", false, "")
flagVersion := flag.Bool("version", false, "")
flag.Parse()
@ -52,12 +46,6 @@ func main() {
os.Exit(0)
}
// -version flag
if *flagVersion == true {
printVersion()
os.Exit(0)
}
// Run WEB server
err := runServer(*flagConfig)
if err != nil {

@ -53,20 +53,18 @@ func runServer(configFile string) error {
}
// Print init info
println("path: config file:", configFile)
println("path: web root:", config.WebRoot)
println("config: site map: enable:", config.SiteMap.Enable)
println("Config file:", configFile)
// Run server
errs := make(chan error, 1)
if config.HTTP.Enable {
println("run: http:", config.HTTP.Port)
println("HTTP server:", config.HTTP.Port)
serveHTTP(config.HTTP.Port, errs)
}
if config.HTTPS.Enable {
println("run: https:", config.HTTP.Port)
println("HTTPS server:", config.HTTP.Port)
serveHTTPS(config.HTTPS.Port, config.HTTPS.Cert, config.HTTPS.Key, errs)
}

Loading…
Cancel
Save