404 to static file server

This commit is contained in:
breel
2020-08-28 15:43:25 -06:00
parent ec5223d530
commit cf3a289a54
4 changed files with 70 additions and 0 deletions

View File

@@ -4,6 +4,7 @@ import (
"io/ioutil"
"local/args"
"os"
"path"
"strings"
"time"
)
@@ -21,6 +22,7 @@ type Config struct {
RPS int
SysRPS int
Delay time.Duration
StaticRoot string
}
func New() Config {
@@ -35,6 +37,7 @@ func New() Config {
as.Append(args.INT, "p", "port to listen on", 18114)
as.Append(args.STRING, "fileprefix", "path prefix for file service", "/__files__")
as.Append(args.STRING, "api-prefix", "path prefix for api", "api")
as.Append(args.STRING, "static-root", "path to the root of a static file server", "./public")
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", "database driver args to use, like [local/storage.Type,arg1,arg2...] or [/path/to/boltdb]", "map")
@@ -63,5 +66,6 @@ func New() Config {
RPS: as.GetInt("rps"),
SysRPS: as.GetInt("sys-rps"),
APIPrefix: strings.TrimPrefix(as.GetString("api-prefix"), "/"),
StaticRoot: path.Join(as.GetString("static-root")),
}
}