diff --git a/cfg/config.go b/cfg/config.go index ed03401..fbe0107 100644 --- a/cfg/config.go +++ b/cfg/config.go @@ -28,13 +28,15 @@ var ( configJsonPath string // Default values that can be overriden in config.json - Address = "0.0.0.0:80" - TitleEditTemplate = `Edit %s` - TitleTemplate = `%s` - GenericErrorMsg = `Sorry, something went wrong` - SiteTitle = `MycorrhizaWiki` - Theme = `default-light` - Mycelia = []MyceliumConfig{ + Address = "0.0.0.0:80" + TitleEditTemplate = `Edit %s` + TitleTemplate = `%s` + GenericErrorMsg = `Sorry, something went wrong` + SiteTitle = `MycorrhizaWiki` + Theme = `default-light` + HomePage = `/Home` + BinaryLimit int64 = 10 << 20 + Mycelia = []MyceliumConfig{ {[]string{"main"}, "main"}, {[]string{"sys", "system"}, "system"}, } @@ -64,6 +66,8 @@ func readConfig() bool { Address string `json:"address"` Theme string `json:"theme"` SiteTitle string `json:"site-title"` + HomePage string `json:"home-page"` + BinaryLimitMB int64 `json:"binary-limit-mb"` Mycelia []MyceliumConfig `json:"mycelia"` TitleTemplates struct { EditHypha string `json:"edit-hypha"` @@ -82,6 +86,8 @@ func readConfig() bool { SiteTitle = cfg.SiteTitle TitleEditTemplate = cfg.TitleTemplates.EditHypha TitleTemplate = cfg.TitleTemplates.ViewHypha + HomePage = "/" + cfg.HomePage + BinaryLimit = 1024 * cfg.BinaryLimitMB Mycelia = cfg.Mycelia return true diff --git a/fs/html.go b/fs/html.go index 63eed74..cae647c 100644 --- a/fs/html.go +++ b/fs/html.go @@ -15,6 +15,7 @@ func (h *Hypha) asHtml() (string, error) {
Check out Fruit maybe.
-TODO: make this page usable
- `) + http.Redirect(w, rq, cfg.HomePage, http.StatusSeeOther) }) http.Handle("/", r) diff --git a/wiki/config.json b/wiki/config.json index 5e49f42..3d41bce 100644 --- a/wiki/config.json +++ b/wiki/config.json @@ -2,6 +2,8 @@ "address": "0.0.0.0:1737", "theme": "default-light", "site-title": "🍄 MycorrhizaWiki", + "home-page": "Home", + "binary-limit-mb": 10, "title-templates": { "edit-hypha": "Edit %s at MycorrhizaWiki", "view-hypha": "%s at MycorrhizaWiki"