all repos — flounder @ 54767b4d396b25fdb393d4b1b2ad07b36ce57f50

A small site builder for the Gemini protocol

mess with tls settings
alex wennerberg alex@alexwennerberg.com
Mon, 26 Oct 2020 19:31:44 -0700
commit

54767b4d396b25fdb393d4b1b2ad07b36ce57f50

parent

89cd84ba7696efba6ec0427b8f312c873d5b6a2f

4 files changed, 20 insertions(+), 9 deletions(-)

jump to
M README.mdREADME.md

@@ -14,6 +14,11 @@ 1. Install with `go get ...`

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.
M config.goconfig.go

@@ -8,6 +8,8 @@ type Config struct {

FilesDirectory string TemplatesDirectory string Host string + HttpsEnabled bool + Port string SiteTitle string Debug bool SecretKey string
M flounder.tomlflounder.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"
M http.gohttp.go

@@ -377,12 +377,8 @@ serveMux := http.NewServeMux()

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 @@ Addr: ":" + port,

// 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()) + } }