JSON API new spec with deref
This commit is contained in:
@@ -3,8 +3,11 @@ package config
|
||||
import "local/args"
|
||||
|
||||
type Config struct {
|
||||
Port int
|
||||
DBURI string
|
||||
Port int
|
||||
DBURI string
|
||||
Database string
|
||||
FilePrefix string
|
||||
FileRoot string
|
||||
}
|
||||
|
||||
func New() Config {
|
||||
@@ -12,13 +15,19 @@ func New() Config {
|
||||
|
||||
as.Append(args.INT, "p", "port to listen on", 18114)
|
||||
as.Append(args.STRING, "dburi", "database uri", "mongodb://localhost:27017")
|
||||
as.Append(args.STRING, "fileprefix", "path prefix for file service", "/__files__")
|
||||
as.Append(args.STRING, "fileroot", "path to file hosting root", "/tmp/")
|
||||
as.Append(args.STRING, "database", "database name to use", "db")
|
||||
|
||||
if err := as.Parse(); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
return Config{
|
||||
Port: as.GetInt("p"),
|
||||
DBURI: as.GetString("dburi"),
|
||||
Port: as.GetInt("p"),
|
||||
DBURI: as.GetString("dburi"),
|
||||
FilePrefix: as.GetString("fileprefix"),
|
||||
FileRoot: as.GetString("fileroot"),
|
||||
Database: as.GetString("database"),
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user