Set up mongodb c

This commit is contained in:
bel
2020-04-12 20:06:42 +00:00
parent a255d391b5
commit 3a8af0551e
4 changed files with 93 additions and 2 deletions

View File

@@ -6,8 +6,10 @@ import (
)
var (
Port string
Public string
Port string
Public string
StoreAddr string
StoreNS string
)
func init() {
@@ -18,9 +20,13 @@ func New() {
as := args.NewArgSet()
as.Append(args.INT, "p", "port to listen on", 52222)
as.Append(args.STRING, "d", "dir with public files", "./public")
as.Append(args.STRING, "s", "mongodb address", "localhost:27017")
as.Append(args.STRING, "ns", "mongodb database", "cheqbooq")
if err := as.Parse(); err != nil {
panic(err)
}
Port = fmt.Sprintf(":%d", as.GetInt("p"))
Public = as.GetString("d")
StoreAddr = as.GetString("s")
StoreNS = as.GetString("ns")
}