diff options
Diffstat (limited to 'conf/main.go')
-rw-r--r-- | conf/main.go | 67 |
1 files changed, 67 insertions, 0 deletions
diff --git a/conf/main.go b/conf/main.go index 182d97f..d0785f8 100644 --- a/conf/main.go +++ b/conf/main.go @@ -71,6 +71,11 @@ func main() { 9: SetPath(), 10: SetAddress(), 11: ListEndpoints(), + + 12: SetHost(), + 13: GetHost(), + 14: SetLogin(), + 15: GetLogin(), } for val, cmd := range cmds { @@ -116,3 +121,65 @@ func SchemaVersion() *Command { }, } } + + +func SetHost() *Command { + return &Command{ + Flag: "set-host-address", + Usage: "set the address to serve the reverse proxy on", + Invoke: func() { + OpenDb() + defer p.Close() + address := ReadLine("Address: ") + err := p.SetHostAddress(address) + if err != nil { log.Fatal(err) } + fmt.Printf("set host address to %v\n", address) + }, + } +} + + +func GetHost() *Command { + return &Command{ + Flag: "get-host-address", + Usage: "get the address to serve the reverse proxy on", + Invoke: func() { + OpenDb() + defer p.Close() + address, err := p.GetHostAddress() + if err != nil { log.Fatal(err) } + fmt.Printf("host address is %v\n", address) + }, + } +} + + +func SetLogin() *Command { + return &Command{ + Flag: "set-login-page", + Usage: "set the file to serve as the login page", + Invoke: func() { + OpenDb() + defer p.Close() + path := ReadLine("File Path (blank for internal default): ") + err := p.SetLoginPage(path) + if err != nil { log.Fatal(err) } + fmt.Printf("set login page to %v\n", path) + }, + } +} + + +func GetLogin() *Command { + return &Command{ + Flag: "get-login-page", + Usage: "get the file to serve the reverse proxy on", + Invoke: func() { + OpenDb() + defer p.Close() + path, err := p.GetLoginPage() + if err != nil { log.Fatal(err) } + fmt.Printf("login page is at %v\n", path) + }, + } +} |