initial commit
This commit is contained in:
39
cmd/beerpong-elo.go
Normal file
39
cmd/beerpong-elo.go
Normal file
@@ -0,0 +1,39 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
beerpongelo "git.kapelle.org/niklas/beerpong-elo/internal"
|
||||
"github.com/alexflint/go-arg"
|
||||
)
|
||||
|
||||
type args struct {
|
||||
DBHost string `arg:"--db-endpoint,required,env:DB_HOST" help:"IP or hostname of the DB" placeholder:"DB_HOST"`
|
||||
DBUsername string `arg:"--db-username,required,env:DB_USERNAME" help:"Username for the DB" placeholder:"DB_USERNAME"`
|
||||
DBPassword string `arg:"--db-password,required,env:DB_PASSWORD" help:"Password for the DB" placeholder:"DB_PASSWORD"`
|
||||
DBName string `arg:"--db-name,required,env:DB_NAME" help:"Name of the DB" placeholder:"DB_NAME"`
|
||||
Address string `arg:"--address,env:ADDRESS" default:":3000" help:"What address to listen on" placeholder:"ADDRESS"`
|
||||
Import string `arg:"--import" help:"Import a json file and exit" placeholder:"data.json"`
|
||||
}
|
||||
|
||||
func (args) Version() string {
|
||||
return "beerpong-elo v0.1"
|
||||
}
|
||||
|
||||
func main() {
|
||||
var args args
|
||||
arg.MustParse(&args)
|
||||
|
||||
config := beerpongelo.Config{
|
||||
DBHost: args.DBHost,
|
||||
DBUsername: args.DBUsername,
|
||||
DBPassword: args.DBPassword,
|
||||
DBName: args.DBName,
|
||||
Address: args.Address,
|
||||
}
|
||||
|
||||
if args.Import != "" {
|
||||
beerpongelo.Import(config,args.Import)
|
||||
return
|
||||
}
|
||||
|
||||
beerpongelo.Start(config)
|
||||
}
|
||||
Reference in New Issue
Block a user