2020-07-29 16:21:55 +02:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
2020-07-31 20:11:31 +02:00
|
|
|
"gopkg.in/alecthomas/kingpin.v2"
|
2020-07-29 16:21:55 +02:00
|
|
|
)
|
|
|
|
|
2020-07-31 20:11:31 +02:00
|
|
|
func main() {
|
2020-09-05 00:11:57 +02:00
|
|
|
var (
|
|
|
|
dir = kingpin.Flag("directory", "Path to dir which has to be served.").Required().Short('d').String()
|
|
|
|
port = kingpin.Flag("port", "Port to run at").Default("8080").Short('p').String()
|
|
|
|
cors = kingpin.Flag("cors", "Add CORS headers").Short('c').StringMap()
|
|
|
|
cache = kingpin.Flag("cache", "Add Cache headers").StringMap()
|
|
|
|
)
|
|
|
|
|
2020-07-31 20:11:31 +02:00
|
|
|
kingpin.Version("0.5")
|
|
|
|
kingpin.Parse()
|
2020-07-29 16:21:55 +02:00
|
|
|
|
|
|
|
s := Server{
|
2020-08-01 23:06:34 +02:00
|
|
|
port: ":" + *port,
|
2020-07-31 20:11:31 +02:00
|
|
|
dirPath: *dir,
|
2020-09-05 00:11:57 +02:00
|
|
|
cors: *cors,
|
|
|
|
cache: *cache,
|
2020-07-29 16:21:55 +02:00
|
|
|
}
|
2020-09-05 00:11:57 +02:00
|
|
|
s.serve()
|
2020-07-29 16:21:55 +02:00
|
|
|
}
|