Change config to use local/storage
This commit is contained in:
@@ -4,14 +4,14 @@ import (
|
||||
"io/ioutil"
|
||||
"local/args"
|
||||
"os"
|
||||
"strings"
|
||||
"time"
|
||||
)
|
||||
|
||||
type Config struct {
|
||||
Port int
|
||||
DBURI string
|
||||
Database string
|
||||
DriverType string
|
||||
Driver []string
|
||||
FilePrefix string
|
||||
FileRoot string
|
||||
Auth bool
|
||||
@@ -32,11 +32,10 @@ func New() Config {
|
||||
f.Close()
|
||||
|
||||
as.Append(args.INT, "p", "port to listen on", 18114)
|
||||
as.Append(args.STRING, "dburi", "database uri", f.Name())
|
||||
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")
|
||||
as.Append(args.STRING, "driver-type", "database driver to use, [boltdb mongo map]", "map")
|
||||
as.Append(args.STRING, "driver", "database driver args to use, like [local/storage.Type,arg1,arg2...] or [/path/to/boltdb]", "map")
|
||||
as.Append(args.BOOL, "auth", "check for authorized access", false)
|
||||
as.Append(args.DURATION, "authlifetime", "duration auth is valid for", time.Hour)
|
||||
as.Append(args.DURATION, "delay", "time to delay requests", time.Duration(0))
|
||||
@@ -51,11 +50,10 @@ func New() Config {
|
||||
|
||||
return Config{
|
||||
Port: as.GetInt("p"),
|
||||
DBURI: as.GetString("dburi"),
|
||||
FilePrefix: as.GetString("fileprefix"),
|
||||
FileRoot: as.GetString("fileroot"),
|
||||
Database: as.GetString("database"),
|
||||
DriverType: as.GetString("driver-type"),
|
||||
Driver: strings.Split(as.GetString("driver"), ","),
|
||||
Auth: as.GetBool("auth"),
|
||||
AuthLifetime: as.GetDuration("authlifetime"),
|
||||
Delay: as.GetDuration("delay"),
|
||||
|
||||
Reference in New Issue
Block a user