aboutsummaryrefslogtreecommitdiff
path: root/cmd/server/main.go
diff options
context:
space:
mode:
authorMitchell Riedstra <mitch@riedstra.dev>2021-07-12 23:06:42 -0400
committerMitchell Riedstra <mitch@riedstra.dev>2021-07-12 23:06:42 -0400
commit2734c671324e980ef7424e367461ebaa4e0034a5 (patch)
treed4ee457c18002011b9e5a5927baa34e5b6d7b16c /cmd/server/main.go
parent3f47f136de6a79adedbe16329586944c6a90ee65 (diff)
downloadgo-website-2734c671324e980ef7424e367461ebaa4e0034a5.tar.gz
go-website-2734c671324e980ef7424e367461ebaa4e0034a5.tar.xz
Add atom feed to site, require config.yml
Diffstat (limited to 'cmd/server/main.go')
-rw-r--r--cmd/server/main.go14
1 files changed, 11 insertions, 3 deletions
diff --git a/cmd/server/main.go b/cmd/server/main.go
index b2a95c3..b1e53d9 100644
--- a/cmd/server/main.go
+++ b/cmd/server/main.go
@@ -37,7 +37,8 @@ func main() {
directory := fl.String("d", ".", "Directory to serve.")
version := fl.Bool("v", false, "Print the version then exit")
fl.StringVar(&page.TimeFormat, "T", page.TimeFormat, "Print the version then exit")
- indexPath := fl.String("i", "/reIndex",
+ defaultIndexPath := "/reIndex"
+ indexPath := fl.String("i", defaultIndexPath,
"Path in which, when called will rebuild the index and clear the cache")
_ = fl.Parse(os.Args[1:])
@@ -55,8 +56,15 @@ func main() {
app = &App{}
}
- app.ReIndexPath = *indexPath
- app.StaticDirectory = "static"
+ if app.ReIndexPath == "" || *indexPath != defaultIndexPath {
+ app.ReIndexPath = *indexPath
+ }
+ if app.StaticDirectory == "" {
+ app.StaticDirectory = "static"
+ }
+ if app.FeedPrefix == "" {
+ app.FeedPrefix = FeedPrefixDefault
+ }
b, _ := yaml.Marshal(app)
os.Stderr.Write(b)