Skip to content

Commit

Permalink
update globalping client
Browse files Browse the repository at this point in the history
  • Loading branch information
radulucut authored and mr-karan committed Sep 30, 2024
1 parent ea74e1f commit 4efa45b
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 7 deletions.
18 changes: 14 additions & 4 deletions cmd/doggo/cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"encoding/json"
"fmt"
"log/slog"
"math"
"os"
"sync"
"time"
Expand Down Expand Up @@ -186,10 +187,19 @@ func parseAndLoadFlags(f *flag.FlagSet) error {
}

func initializeApp(logger *slog.Logger, cfg *config) *app.App {
globlpingClient := globalping.NewClient(globalping.Config{
APIURL: "https://api.globalping.io/v1",
APIToken: os.Getenv("GLOBALPING_TOKEN"),
})
gpConfig := globalping.Config{
APIURL: "https://api.globalping.io/v1",
AuthURL: "https://auth.globalping.io",
UserAgent: fmt.Sprintf("doggo/%s (https://github.com/mr-karan/doggo)", buildVersion),
}
gpToken := os.Getenv("GLOBALPING_TOKEN")
if gpToken != "" {
gpConfig.AuthToken = &globalping.Token{
AccessToken: gpToken,
Expiry: time.Now().Add(math.MaxInt64),
}
}
globlpingClient := globalping.NewClient(gpConfig)

app := app.New(logger, globlpingClient, buildVersion)

Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ require (
github.com/ameshkov/dnsstamps v1.0.3
github.com/fatih/color v1.17.0
github.com/go-chi/chi/v5 v5.1.0
github.com/jsdelivr/globalping-cli v1.3.1-0.20240717104136-2edb7127957b
github.com/jsdelivr/globalping-cli v1.3.1-0.20240925142143-6b5f0951f8e1
github.com/knadh/koanf/parsers/toml v0.1.0
github.com/knadh/koanf/providers/env v0.1.0
github.com/knadh/koanf/providers/file v1.0.0
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI=
github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
github.com/google/pprof v0.0.0-20240625030939-27f56978b8b0 h1:e+8XbKB6IMn8A4OAyZccO4pYfB3s7bt6azNIPE7AnPg=
github.com/google/pprof v0.0.0-20240625030939-27f56978b8b0/go.mod h1:K1liHPHnj73Fdn/EKuT8nrFqBihUSKXoLYU0BuatOYo=
github.com/jsdelivr/globalping-cli v1.3.1-0.20240717104136-2edb7127957b h1:ZL7LfEaU+P2r6/Lxo99Qt6qw4Mb3BXt5UB4r+RoI6LA=
github.com/jsdelivr/globalping-cli v1.3.1-0.20240717104136-2edb7127957b/go.mod h1:2+lO4/xYSauKsf+pZ62bro1c4StxDO3cYcrLx4jsYmI=
github.com/jsdelivr/globalping-cli v1.3.1-0.20240925142143-6b5f0951f8e1 h1:UrEC+iF/FHS/5UTJZJXOkm8y7wct2sqhNftJ2WQN7WI=
github.com/jsdelivr/globalping-cli v1.3.1-0.20240925142143-6b5f0951f8e1/go.mod h1:2+lO4/xYSauKsf+pZ62bro1c4StxDO3cYcrLx4jsYmI=
github.com/knadh/koanf/maps v0.1.1 h1:G5TjmUh2D7G2YWf5SQQqSiHRJEjaicvU0KpypqB3NIs=
github.com/knadh/koanf/maps v0.1.1/go.mod h1:npD/QZY3V6ghQDdcQzl1W4ICNVTkohC8E73eI2xW4yI=
github.com/knadh/koanf/parsers/toml v0.1.0 h1:S2hLqS4TgWZYj4/7mI5m1CQQcWurxUz6ODgOub/6LCI=
Expand Down

0 comments on commit 4efa45b

Please sign in to comment.