Added path option.

This commit is contained in:
Anand Patil 2017-01-24 12:06:58 -05:00
parent 92d8d62ae1
commit 1ca7dea205
3 changed files with 5 additions and 1 deletions

View file

@ -55,6 +55,7 @@ type App struct {
type Options struct {
Address string `hcl:"address"`
Port string `hcl:"port"`
Path string `hcl:"path"`
PermitWrite bool `hcl:"permit_write"`
EnableBasicAuth bool `hcl:"enable_basic_auth"`
Credential string `hcl:"credential"`
@ -85,6 +86,7 @@ var Version = "0.0.13"
var DefaultOptions = Options{
Address: "",
Port: "8080",
Path: "",
PermitWrite: false,
EnableBasicAuth: false,
Credential: "",
@ -168,7 +170,7 @@ func (app *App) Run() error {
log.Printf("Once option is provided, accepting only one client")
}
path := ""
path := app.options.Path
if app.options.EnableRandomUrl {
path += "/" + generateRandomString(app.options.RandomUrlLength)
}