feat: refactor configuration + html page template data

This commit is contained in:
2023-09-24 09:33:20 -06:00
parent c2f8be504e
commit bf14a70efe
10 changed files with 59 additions and 43 deletions

View File

@ -1,7 +1,6 @@
package main
import (
"flag"
"log"
"os"
"os/signal"
@ -19,30 +18,17 @@ func main() {
log.Fatalf("[ERROR] %+v", errors.WithStack(err))
}
// Global Options
address := flag.String("address", opts.Address, "server listening address")
// SSH Options
sockDir := flag.String("ssh-sock-dir", opts.SSH.SockDir, "ssh sock directory")
publicPort := flag.Uint("ssh-public-port", opts.SSH.PublicPort, "ssh public port")
publicHost := flag.String("ssh-public-host", opts.SSH.PublicHost, "ssh public host")
hostKey := flag.String("ssh-host-key", opts.SSH.HostKey, "ssh host key")
// HTTP Options
customDir := flag.String("http-custom-dir", opts.HTTP.CustomDir, "http custom templates/assets directory")
flag.Parse()
server := rebound.NewServer(
rebound.WithAddress(*address),
rebound.WithAddress(opts.Address),
rebound.WithSSHOption(
ssh.WithSockDir(*sockDir),
ssh.WithPublicHost(*publicHost),
ssh.WithPublicPort(*publicPort),
ssh.WithHostKey(*hostKey),
ssh.WithSockDir(opts.SSH.SockDir),
ssh.WithPublicHost(opts.SSH.PublicHost),
ssh.WithPublicPort(opts.SSH.PublicPort),
ssh.WithHostKey(opts.SSH.HostKey),
),
rebound.WitHTTPOption(
http.WithCustomDir(*customDir),
http.WithCustomDir(opts.HTTP.CustomDir),
http.WithTemplateData(opts.HTTP.TemplateData),
),
)