Default to bolt db proper

master
Bel LaPointe 2020-07-23 21:14:54 -06:00
parent d650db5206
commit bdfc1c346b
1 changed files with 12 additions and 2 deletions

View File

@ -1,6 +1,10 @@
package config package config
import "local/args" import (
"io/ioutil"
"local/args"
"os"
)
type Config struct { type Config struct {
Port int Port int
@ -14,8 +18,14 @@ type Config struct {
func New() Config { func New() Config {
as := args.NewArgSet() as := args.NewArgSet()
f, err := ioutil.TempFile(os.TempDir(), "bolt.db.*")
if err != nil {
panic(err)
}
f.Close()
as.Append(args.INT, "p", "port to listen on", 18114) as.Append(args.INT, "p", "port to listen on", 18114)
as.Append(args.STRING, "dburi", "database uri", "mongodb://localhost:27017") as.Append(args.STRING, "dburi", "database uri", f.Name())
as.Append(args.STRING, "fileprefix", "path prefix for file service", "/__files__") 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, "fileroot", "path to file hosting root", "/tmp/")
as.Append(args.STRING, "database", "database name to use", "db") as.Append(args.STRING, "database", "database name to use", "db")