aboutsummaryrefslogtreecommitdiff
path: root/cmd/server/main.go
diff options
context:
space:
mode:
authorMitchell Riedstra <mitch@riedstra.dev>2021-02-15 15:31:37 -0500
committerMitchell Riedstra <mitch@riedstra.dev>2021-02-15 15:32:05 -0500
commitfe9ec7a0b45c9fd23a615a8b95ade3e9c1ea2d12 (patch)
tree80844a62d5d18b30862cfdc610aae88713fe97d9 /cmd/server/main.go
parentd83f4bca3f7026696a41225caac11807ed06fc2f (diff)
downloadgo-website-fe9ec7a0b45c9fd23a615a8b95ade3e9c1ea2d12.tar.gz
go-website-fe9ec7a0b45c9fd23a615a8b95ade3e9c1ea2d12.tar.xz
Another re-structure. Deleting code is wonderful.v0.0.12
Diffstat (limited to 'cmd/server/main.go')
-rw-r--r--cmd/server/main.go16
1 files changed, 10 insertions, 6 deletions
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,