parse variables
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Arnas Udovicius 2022-08-18 01:12:11 +03:00
parent c82256e5a1
commit c185854e14
2 changed files with 8 additions and 3 deletions

View file

@ -28,13 +28,14 @@ func init() {
flag.StringVar(&certificatePath, "certificatePath", "", "capsule certificate path")
flag.StringVar(&fileSrvHost, "fileSrvHost", "", "file push server host")
flag.StringVar(&fileSrvPort, "fileSrvPort", "", "file push server port")
flag.Parse()
}
func main() {
certificates := &certificate.Store{}
certificates.Register(hostname)
if err := certificates.Load(certificatePath); err != nil {
log.Fatal(err)
panic(err)
}
mux := &gemini.Mux{}
@ -74,7 +75,11 @@ func renderIndex(lang string, w gemini.ResponseWriter) {
summery := GetSummery()
fmt.Println(summery)
tree := TSummery{}
json.Unmarshal([]byte(summery), &tree)
err = json.Unmarshal([]byte(summery), &tree)
if err != nil {
w.WriteHeader(gemini.StatusTemporaryFailure, "Internal server error")
return
}
fmt.Println(tree)
categories := ""

View file

@ -7,7 +7,7 @@ import (
)
func GetSummery() string {
conn, err := net.Dial("tcp", "127.0.0.1:8301")
conn, err := net.Dial("tcp", fileSrvHost+":"+fileSrvPort)
if err != nil {
panic(err.Error())
}