diff options
author | sanine-a <sanine.not@pm.me> | 2023-05-02 15:39:16 -0500 |
---|---|---|
committer | sanine-a <sanine.not@pm.me> | 2023-05-02 15:39:16 -0500 |
commit | f3d05a65ffc6862c2f655c9699b718c9a4286aaa (patch) | |
tree | 544d81fc117546de0b7ca2b2a8854bba00a0e703 /conf | |
parent | b0d8eb635ccc4b95979714f93051cc8cd9757cd1 (diff) |
add configuration of host address and login page
Diffstat (limited to 'conf')
-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) + }, + } +} |