flounder

A simple gemini site builder
Log | Files | Refs | README | LICENSE

commit 54767b4d396b25fdb393d4b1b2ad07b36ce57f50
parent 89cd84ba7696efba6ec0427b8f312c873d5b6a2f
Author: alex wennerberg <alex@alexwennerberg.com>
Date:   Mon, 26 Oct 2020 19:31:44 -0700

mess with tls settings

Diffstat:
MREADME.md | 5+++++
Mconfig.go | 2++
Mflounder.toml | 8++++++--
Mhttp.go | 14+++++++-------
4 files changed, 20 insertions(+), 9 deletions(-)

diff --git a/README.md b/README.md @@ -14,6 +14,11 @@ Once you've installed Flounder, you'll want to set the configuration variables. 2. For local testing, flounder will generate a TLS cert for you. However, for production, you'll need to generate a cert that matches \*.your-domain signed by a Certificate Authority. 3. Set the cookie store key +configure flounder.toml +change host + +To limit security concerns, we don't want to run this server as root. + I'm working on an admin interface and some admin tools, but right now, you'll have to do a lot of administration at the command line via sqlite Flounder uses the HTTP templates in the specified templates folder. If you want to modify the look and feel of your site, or host new files, you can modify these files. diff --git a/config.go b/config.go @@ -8,6 +8,8 @@ type Config struct { FilesDirectory string TemplatesDirectory string Host string + HttpsEnabled bool + Port string SiteTitle string Debug bool SecretKey string diff --git a/flounder.toml b/flounder.toml @@ -1,8 +1,12 @@ # Used in HTML templates and titles SiteTitle="­čÉčflounder" -# Include port if != 443 -Host="localhost:8443" +# Include port if running locally +Host="localhost:8080" + +# Set this depending on whether you want to run this service standalone or through a reverse proxy server +Port="8443" +HttpsEnabled=false # Folder containing subfolders for each user's files FilesDirectory="./files" diff --git a/http.go b/http.go @@ -377,12 +377,8 @@ func runHTTPServer() { s := strings.SplitN(c.Host, ":", 2) hostname := s[0] - var port string - if len(s) > 1 { - port = s[1] - } else { - port = "443" - } + port := c.Port + serveMux.HandleFunc(hostname+"/", rootHandler) serveMux.HandleFunc(hostname+"/my_site", mySiteHandler) serveMux.HandleFunc(hostname+"/edit/", editFileHandler) @@ -407,5 +403,9 @@ func runHTTPServer() { // TLSConfig: tlsConfig, Handler: wrapped, } - log.Fatal(srv.ListenAndServeTLS(c.TLSCertFile, c.TLSKeyFile)) + if c.HttpsEnabled { + log.Fatal(srv.ListenAndServeTLS(c.TLSCertFile, c.TLSKeyFile)) + } else { + log.Fatal(srv.ListenAndServe()) + } }