]> Sergey Matveev's repositories - sgblog.git/blobdiff - cmd/sgblog/main.go
Experimental gemini support
[sgblog.git] / cmd / sgblog / main.go
index ef3ff45d0128cf97c112c994f222e8e76a21553a..8dbb1d8156ef1d03c63cda655562bc79e978ad9d 100644 (file)
@@ -1,5 +1,5 @@
 /*
-SGBlog -- Git-backed CGI/inetd blogging/phlogging engine
+SGBlog -- Git-backed CGI/UCSPI blogging/phlogging/gemlogging engine
 Copyright (C) 2020-2021 Sergey Matveev <stargrave@stargrave.org>
 
 This program is free software: you can redistribute it and/or modify
@@ -15,7 +15,7 @@ You should have received a copy of the GNU Affero General Public License
 along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
 
-// Git-backed CGI/inetd blogging/phlogging engine
+// Git-backed CGI/UCSPI blogging/phlogging/gemlogging engine
 package main
 
 import (
@@ -24,6 +24,7 @@ import (
        "flag"
        "fmt"
        "io/ioutil"
+       "log"
        "regexp"
        "strings"
 
@@ -146,15 +147,20 @@ func readCfg(cfgPath string) (*Cfg, error) {
 
 func main() {
        gopherCfgPath := flag.String("gopher", "", "Path to gopher-related configuration file")
+       geminiCfgPath := flag.String("gemini", "", "Path to gemini-related configuration file")
        flag.Usage = func() {
                fmt.Fprintf(flag.CommandLine.Output(), `Usage of sgblog:
        sgblog -- run CGI HTTP backend
        sgblog -gopher /path/to/cfg.hjson -- run UCSPI/inetd Gopher backend
+       sgblog -gemini /path/to/cfg.hjson -- run UCSPI+tlss Gemini backend
 `)
        }
        flag.Parse()
+       log.SetFlags(log.Lshortfile)
        if *gopherCfgPath != "" {
                serveGopher(*gopherCfgPath)
+       } else if *geminiCfgPath != "" {
+               serveGemini(*geminiCfgPath)
        } else {
                serveHTTP()
        }