added region support, fixed minor bugs
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
4807355add
commit
77b88325cf
8 changed files with 121 additions and 16 deletions
|
@ -2,7 +2,6 @@ package main
|
|||
|
||||
import (
|
||||
"log"
|
||||
"fmt"
|
||||
"net/http"
|
||||
"time"
|
||||
"io/ioutil"
|
||||
|
@ -23,7 +22,7 @@ type Server struct {
|
|||
}
|
||||
|
||||
func main() {
|
||||
dsn := "postgres://postgres:secret@localhost/postgres?sslmode=disable"
|
||||
dsn := "postgres://postgres:secret@postgres:5432/postgres?sslmode=disable"
|
||||
|
||||
store, err := postgres.NewStore(dsn)
|
||||
if err != nil {
|
||||
|
@ -49,7 +48,7 @@ func main() {
|
|||
}
|
||||
|
||||
func updateServers(serverString string, store steamServer.Store) {
|
||||
url := "http://api.spenny.eu/server/" + serverString
|
||||
url := "http://steam-server-api:8080/server/" + serverString
|
||||
|
||||
reqClient := http.Client {
|
||||
Timeout: time.Second * 2,
|
||||
|
@ -77,7 +76,6 @@ func updateServers(serverString string, store steamServer.Store) {
|
|||
|
||||
server := steamServer.Server{}
|
||||
json.Unmarshal([]byte(body), &server)
|
||||
store.UpdateServerByQuery(&server)
|
||||
fmt.Println(&server)
|
||||
store.UpdateServerByQuery(&server, serverString)
|
||||
}
|
||||
|
||||
|
|
Reference in a new issue