From fe9ec7a0b45c9fd23a615a8b95ade3e9c1ea2d12 Mon Sep 17 00:00:00 2001 From: Mitchell Riedstra Date: Mon, 15 Feb 2021 15:31:37 -0500 Subject: Another re-structure. Deleting code is wonderful. --- cmd/server/main.go | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) (limited to 'cmd') diff --git a/cmd/server/main.go b/cmd/server/main.go index c900234..9ec96da 100644 --- a/cmd/server/main.go +++ b/cmd/server/main.go @@ -8,8 +8,7 @@ import ( "os" "time" - siteHttp "riedstra.dev/mitch/go-website/http" - "riedstra.dev/mitch/go-website/local" + "riedstra.dev/mitch/go-website/page" ) var VersionString = "" @@ -24,9 +23,9 @@ func main() { listen := fl.String("l", "0.0.0.0:8001", "Listening address") directory := fl.String("d", ".", "Directory to serve.") version := fl.Bool("v", false, "Print the version then exit") - fl.StringVar(&local.TimeFormat, "T", local.TimeFormat, "Print the version then exit") - fl.StringVar(&siteHttp.ReindexRedirectTo, "r", - siteHttp.ReindexRedirectTo, "Page to redirect to after reindex") + fl.StringVar(&page.TimeFormat, "T", page.TimeFormat, "Print the version then exit") + indexPath := fl.String("i", "/reIndex", + "Path in which, when called will rebuild the index and clear the cache") _ = fl.Parse(os.Args[1:]) if *version { @@ -37,8 +36,13 @@ func main() { log.Fatal(err) } + app := &App{ + ReIndexPath: *indexPath, + StaticDirectory: "static", + } + srv := &http.Server{ - Handler: siteHttp.GetHandler(), + Handler: app, Addr: *listen, WriteTimeout: 15 * time.Second, ReadTimeout: 15 * time.Second, -- cgit v1.2.3