2026-02-14 15:40:12 +00:00
|
|
|
package stadia
|
|
|
|
|
|
|
|
|
|
import (
|
2026-02-25 02:45:17 +00:00
|
|
|
"crypto/tls"
|
2026-03-04 18:29:52 +00:00
|
|
|
"github.com/rs/zerolog/log"
|
2026-02-25 02:45:17 +00:00
|
|
|
"os"
|
2026-02-14 15:40:12 +00:00
|
|
|
"resty.dev/v3"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
type StadiaMaps struct {
|
|
|
|
|
APIKey string
|
|
|
|
|
|
|
|
|
|
client *resty.Client
|
|
|
|
|
urlBase string
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func NewStadiaMaps(api_key string) *StadiaMaps {
|
|
|
|
|
//logger := NewLogger(log.Logger)
|
|
|
|
|
//r := resty.New().SetLogger(logger).SetDebug(true)
|
2026-02-14 16:49:54 +00:00
|
|
|
//r := resty.New().SetDebug(true)
|
|
|
|
|
r := resty.New()
|
2026-02-25 02:45:17 +00:00
|
|
|
if os.Getenv("STADIA_INSECURE_SKIP_VERIFY") != "" {
|
2026-03-04 18:29:52 +00:00
|
|
|
log.Warn().Msg("Using insecure TLS verification settings")
|
2026-02-25 02:45:17 +00:00
|
|
|
r.SetTLSClientConfig(&tls.Config{
|
|
|
|
|
InsecureSkipVerify: true,
|
|
|
|
|
})
|
|
|
|
|
}
|
2026-02-14 15:40:12 +00:00
|
|
|
return &StadiaMaps{
|
|
|
|
|
APIKey: api_key,
|
|
|
|
|
client: r,
|
|
|
|
|
urlBase: "api.stadiamaps.com",
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func (s *StadiaMaps) Close() {
|
|
|
|
|
s.client.Close()
|
|
|
|
|
}
|