Move gob Register functions to pokerogue-server.go

pull/4/head
maru 8 months ago
parent dbcc0d04e6
commit 9f1349d6a0
No known key found for this signature in database
GPG Key ID: 37689350E9CD0F0D

@ -2,7 +2,6 @@ package api
import ( import (
"encoding/base64" "encoding/base64"
"encoding/gob"
"encoding/json" "encoding/json"
"fmt" "fmt"
"log" "log"
@ -32,9 +31,6 @@ func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) {
s.Exit.RLock() s.Exit.RLock()
defer s.Exit.RUnlock() defer s.Exit.RUnlock()
gob.Register([]interface{}{})
gob.Register(map[string]interface{}{})
if s.Debug { if s.Debug {
w.Header().Set("Access-Control-Allow-Headers", "*") w.Header().Set("Access-Control-Allow-Headers", "*")
w.Header().Set("Access-Control-Allow-Methods", "*") w.Header().Set("Access-Control-Allow-Methods", "*")

@ -1,6 +1,7 @@
package main package main
import ( import (
"encoding/gob"
"flag" "flag"
"log" "log"
"net" "net"
@ -29,6 +30,11 @@ func main() {
flag.Parse() flag.Parse()
// register gob types
gob.Register([]interface{}{})
gob.Register(map[string]interface{}{})
// get database connection // get database connection
err := db.Init(*dbuser, *dbpass, *dbproto, *dbaddr, *dbname) err := db.Init(*dbuser, *dbpass, *dbproto, *dbaddr, *dbname)
if err != nil { if err != nil {

Loading…
Cancel
Save