miki

Miki: personal wiki with the fmd markup format
git clone https://wtenison.com/repo/miki.git
Log | Files | Refs | README | LICENSE

commit e26f5c8c2be83593545b3fe7752c0f79d1124ade
parent 7c85b2d5cd8538429cf9c3e788be8371ca7b22a5
Author: weetat <wtenison@protonmail.com>
Date:   Thu, 27 Feb 2025 19:04:48 +0000

Remove TLS handling and serve plain HTTP

nginx terminates TLS in front of the app now, so drop the cert and key
config and use ListenAndServe. Also comment out the card section on the
subject page.

Diffstat:
Msrc/filesystem/files.go | 4++--
Msrc/filesystem/filesystem.go | 2+-
Msrc/network/network.go | 33++++++---------------------------
Mweb/subject/index.html | 4++--
4 files changed, 11 insertions(+), 32 deletions(-)

diff --git a/src/filesystem/files.go b/src/filesystem/files.go @@ -10,11 +10,11 @@ func ReadFileJSON(filePath string, outputDataContainer interface{}) error { _fsData, _err := os.ReadFile(filePath) if _err != nil { - return fmt.Errorf("_ERROR\tfilesystem:ReadFileJSON:os.ReadFile:%s:%s", filePath, _err.Error()) + return fmt.Errorf("ReadFileJSON:os.ReadFile:%s:%s", filePath, _err.Error()) } if _err = json.Unmarshal(_fsData, &outputDataContainer); _err != nil { - return fmt.Errorf("_ERROR\tfilesystem:ReadFileJSON:json.Unmarshal:%s:%s", filePath, _err.Error()) + return fmt.Errorf("ReadFileJSON:json.Unmarshal:%s:%s", filePath, _err.Error()) } return nil diff --git a/src/filesystem/filesystem.go b/src/filesystem/filesystem.go @@ -19,7 +19,7 @@ func Init() { } if _err := ReadFileJSON("sys/config.json", &_fsDataStruct); _err != nil { - log.Panicf("__PANIC\tfilesystem:%s", _err) + log.Panicf("__PANIC\tfilesystem:Init:%s", _err) } Dirs["data"] = _fsDataStruct.DataDirectory diff --git a/src/network/network.go b/src/network/network.go @@ -3,17 +3,12 @@ package network import ( "log" "net/http" - "os" - "path/filepath" mfs "miki/src/filesystem" ) var serverInfo struct { - port string - sslPath string - certFile string - keyFile string + port string } func Init() { @@ -21,10 +16,7 @@ func Init() { //// GET SERVER INFO FROM SYSTEM type ServerInfo struct { - Port string `json:"port"` - SslPath string `json:"ssl-path"` - CertFile string `json:"cert-file"` - KeyFile string `json:"key-file"` + Port string `json:"port"` } var _siDataStruct struct { @@ -32,25 +24,12 @@ func Init() { } if _err := mfs.ReadFileJSON("sys/config.json", &_siDataStruct); _err != nil { - log.Panicf("__PANIC\tfilesystem:%s", _err) + log.Panicf("__PANIC:network:Init:%s", _err) } serverInfo.port = _siDataStruct.ServerInfo.Port - serverInfo.sslPath = _siDataStruct.ServerInfo.SslPath - serverInfo.certFile = filepath.Join(serverInfo.sslPath, _siDataStruct.ServerInfo.CertFile) - serverInfo.keyFile = filepath.Join(serverInfo.sslPath, _siDataStruct.ServerInfo.KeyFile) - log.Printf("INFO\tnetwork:Init:ServerInfo:%v", serverInfo) - - //// CHECK FOR VALID CERT INFO - - if _, err := os.Stat(serverInfo.certFile); err != nil { - log.Panicf("__PANIC\tnetwork:Init:os.Stat:%s", err) - } - - if _, err := os.Stat(serverInfo.keyFile); err != nil { - log.Panicf("__PANIC\tnetwork:Init:os.Stat:%s", err) - } + log.Printf("INFO:network:Init:ServerInfo:%v", serverInfo) //// MAKE SERVER ROUTES @@ -61,7 +40,7 @@ func Exec() { //// RUN SERVER - if _err := http.ListenAndServeTLS(":"+serverInfo.port, serverInfo.certFile, serverInfo.keyFile, mux); _err != nil { - log.Printf("_ERROR\tnetwork:Exec:ListenAndServeTLS:%s", _err) + if _err := http.ListenAndServe(":"+serverInfo.port, mux); _err != nil { + log.Printf("_ERROR:network:Exec:ListenAndServe:%s", _err) } } diff --git a/web/subject/index.html b/web/subject/index.html @@ -18,9 +18,9 @@ <section id="subject_"> - <section id="_card" class="__container_bg-1"> + <!-- <section id="_card" class="__container_bg-1"> - </section> + </section> --> <section id="_body">