27 lines
627 B
Go
Executable File
27 lines
627 B
Go
Executable File
package main
|
|
|
|
import (
|
|
"fmt"
|
|
"gogs.inhome.blapointe.com/local/args"
|
|
"log"
|
|
"net/http"
|
|
)
|
|
|
|
func main() {
|
|
as := args.NewArgSet()
|
|
as.Append(args.INT, "p", "port to listen on", "8101")
|
|
as.Append(args.BOOL, "debug", "debug mode", false)
|
|
as.Append(args.STRING, "f", "file to abuse", "/tmp/ledger-ui.dat")
|
|
if err := as.Parse(); err != nil {
|
|
panic(err)
|
|
}
|
|
ledger, err := NewLedger(as.GetString("f"))
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
log.Println("listening on", as.GetInt("p"))
|
|
if err := http.ListenAndServe(":"+fmt.Sprint(as.GetInt("p")), Server{ledger: ledger, debug: as.GetBool("debug")}); err != nil {
|
|
panic(err)
|
|
}
|
|
}
|