Simple MJPEG streamer for ESPHome cameras.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

33 lines
817 B

package main
import (
"flag"
"github.com/sirupsen/logrus"
)
var log = logrus.New()
func main() {
var (
config = DefaultConfig()
configPathFlag = flag.String("config", "", "configuration path")
)
flag.StringVar(&config.Listen, "listen", config.Listen, "server listen address")
flag.StringVar(&config.Static, "static", config.Static, "static files path")
flag.StringVar(&config.Template, "template", config.Template, "template files path")
flag.Parse()
if *configPathFlag != "" {
if err := config.Load(*configPathFlag); err != nil {
log.WithField("config", *configPathFlag).Fatalln("error reading configuration")
}
}
s, err := NewServer(config)
if err != nil {
log.Fatalln(err)
}
log.Println("server: starting on http://" + config.Listen)
log.Fatalln(s.Start(config.Listen))
}