mess with tls settings
alex wennerberg alex@alexwennerberg.com
Mon, 26 Oct 2020 19:31:44 -0700
4 files changed,
20 insertions(+),
9 deletions(-)
M
README.md
→
README.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
flounder.toml
→
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"
M
http.go
→
http.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()) + } }