25 lines
395 B
Go
25 lines
395 B
Go
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"),
|
|
}
|
|
}
|