Raspberry Pi alarm clock server.
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.
 
 
 
 

46 lines
814 B

package main
import (
"flag"
"fmt"
"math/rand"
"os"
"time"
"git.kirsle.net/apps/sonar"
"github.com/kirsle/golog"
)
// Build hash.
var Build = "N/A"
var debug bool
var listen string
var version bool
func init() {
rand.Seed(time.Now().UnixNano())
flag.StringVar(&listen, "listen", "127.0.0.1:8000", "Interface to listen on, default localhost only")
flag.BoolVar(&debug, "debug", false, "Debug level logging")
flag.BoolVar(&version, "version", false, "Version number")
flag.BoolVar(&version, "v", false, "Version number (alias)")
}
func main() {
flag.Parse()
if version {
fmt.Printf("sonar v%s build %s\n", sonar.Version, Build)
os.Exit(0)
}
if debug {
log := golog.GetLogger("sonar")
log.Config.Level = golog.DebugLevel
}
app := sonar.New()
app.ListenAndServe(listen)
_ = app
}