Impl storage mongo driver and config

This commit is contained in:
Bel LaPointe
2020-07-12 21:28:52 -06:00
parent 2c13814177
commit 1b051ee1d5
9 changed files with 461 additions and 0 deletions

24
config/config.go Normal file
View File

@@ -0,0 +1,24 @@
package config
import "local/args"
type Config struct {
Port int
DBURI string
}
func New() Config {
as := args.NewArgSet()
as.Append(args.INT, "p", "port to listen on", 18114)
as.Append(args.STRING, "dburi", "database uri", "mongodb://localhost:27017")
if err := as.Parse(); err != nil {
panic(err)
}
return Config{
Port: as.GetInt("p"),
DBURI: as.GetString("dburi"),
}
}