Skip to content

Commit

Permalink
store/serverservice: init client with OAuth support based on configur…
Browse files Browse the repository at this point in the history
…ation
  • Loading branch information
joelrebel committed May 30, 2023
1 parent 7704c6a commit 2121f02
Show file tree
Hide file tree
Showing 4 changed files with 97 additions and 79 deletions.
6 changes: 3 additions & 3 deletions cmd/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ func runWorker(ctx context.Context) {
cancelFunc()
}()

inv, err := initInventory(flasher.Config, flasher.Logger)
inv, err := initInventory(ctx, flasher.Config, flasher.Logger)
if err != nil {
flasher.Logger.Fatal(err)
}
Expand All @@ -88,13 +88,13 @@ func runWorker(ctx context.Context) {
w.Run(ctx)
}

func initInventory(config *app.Configuration, logger *logrus.Logger) (store.Repository, error) {
func initInventory(ctx context.Context, config *app.Configuration, logger *logrus.Logger) (store.Repository, error) {
switch {
// from CLI flags
case strings.HasSuffix(storeKind, ".yml"), strings.HasSuffix(storeKind, ".yaml"):
return store.NewYamlInventory(storeKind)
case storeKind == string(model.InventoryStoreServerservice):
return store.NewServerserviceStore(config.ServerserviceOptions, logger)
return store.NewServerserviceStore(ctx, config.ServerserviceOptions, logger)
}

return nil, errors.Wrap(ErrInventoryStore, "expected a valid inventory store parameter")
Expand Down
27 changes: 9 additions & 18 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ require (
github.com/bmc-toolbox/bmclib/v2 v2.0.1-0.20230426154556-8907c8d39762
github.com/bmc-toolbox/common v0.0.0-20230220061748-93ff001f4a1d
github.com/bombsimon/logrusr/v2 v2.0.1
github.com/coreos/go-oidc v2.1.0+incompatible
github.com/emicklei/dot v1.4.2
github.com/filanov/stateswitch v1.0.1-0.20221115122927-775ae5822fad
github.com/google/uuid v1.3.0
Expand All @@ -25,22 +26,20 @@ require (
github.com/stretchr/testify v1.8.3
go.hollow.sh/serverservice v0.15.3-0.20230519171430-6d4a327f68f3
go.hollow.sh/toolbox v0.6.1-0.20230523125520-f9351bc3442b
go.infratographer.com/x v0.0.15
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.40.0
golang.org/x/net v0.10.0
golang.org/x/oauth2 v0.8.0
)

require (
github.com/VictorLowther/simplexml v0.0.0-20180716164440-0bff93621230 // indirect
github.com/VictorLowther/soap v0.0.0-20150314151524-8e36fca84b22 // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/bytedance/sonic v1.8.9 // indirect
github.com/cenkalti/backoff/v4 v4.2.1 // indirect
github.com/cespare/xxhash/v2 v2.2.0 // indirect
github.com/chenzhuoyu/base64x v0.0.0-20221115062448-fe3a3abad311 // indirect
github.com/cockroachdb/cockroach-go/v2 v2.3.3 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/equinix-labs/otel-init-go v0.0.7 // indirect
github.com/ericlagergren/decimal v0.0.0-20221120152707-495c53812d05 // indirect
github.com/felixge/httpsnoop v1.0.3 // indirect
github.com/friendsofgo/errors v0.9.2 // indirect
github.com/fsnotify/fsnotify v1.6.0 // indirect
github.com/gin-contrib/sse v0.1.0 // indirect
Expand All @@ -53,12 +52,10 @@ require (
github.com/goccy/go-json v0.10.2 // indirect
github.com/gofrs/uuid v4.4.0+incompatible // indirect
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
github.com/golang/mock v1.6.0 // indirect
github.com/golang/protobuf v1.5.3 // indirect
github.com/googleapis/gax-go/v2 v2.8.0 // indirect
github.com/gosimple/slug v1.13.1 // indirect
github.com/gosimple/unidecode v1.0.1 // indirect
github.com/grpc-ecosystem/grpc-gateway/v2 v2.15.2 // indirect
github.com/hashicorp/errwrap v1.1.0 // indirect
github.com/hashicorp/go-cleanhttp v0.5.2 // indirect
github.com/hashicorp/hcl v1.0.0 // indirect
Expand All @@ -78,8 +75,8 @@ require (
github.com/leodido/go-urn v1.2.4 // indirect
github.com/lib/pq v1.10.9 // indirect
github.com/magiconair/properties v1.8.7 // indirect
github.com/mattn/go-colorable v0.1.13 // indirect
github.com/mattn/go-isatty v0.0.19 // indirect
github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/nats-io/jwt/v2 v2.4.0 // indirect
Expand All @@ -89,18 +86,14 @@ require (
github.com/onsi/ginkgo v1.16.5 // indirect
github.com/pelletier/go-toml/v2 v2.0.7 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/prometheus/client_golang v1.15.1 // indirect
github.com/prometheus/client_model v0.3.0 // indirect
github.com/prometheus/common v0.42.0 // indirect
github.com/prometheus/procfs v0.9.0 // indirect
github.com/pquerna/cachecontrol v0.0.0-20171018203845-0dec1b30a021 // indirect
github.com/satori/go.uuid v1.2.0 // indirect
github.com/spf13/afero v1.9.5 // indirect
github.com/spf13/cast v1.5.1 // indirect
github.com/spf13/jwalterweatherman v1.1.0 // indirect
github.com/spf13/pflag v1.0.5 // indirect
github.com/stmcginnis/gofish v0.14.0 // indirect
github.com/subosito/gotenv v1.4.2 // indirect
github.com/toorop/gin-logrus v0.0.0-20210225092905-2c785434f26f // indirect
github.com/twitchyliquid64/golang-asm v0.15.1 // indirect
github.com/ugorji/go/codec v1.2.11 // indirect
github.com/volatiletech/inflect v0.0.1 // indirect
Expand All @@ -112,13 +105,10 @@ require (
github.com/volatiletech/strmangle v0.0.4 // indirect
go.opencensus.io v0.24.0 // indirect
go.opentelemetry.io/otel v1.14.0 // indirect
go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.14.0 // indirect
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.14.0 // indirect
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.14.0 // indirect
go.opentelemetry.io/otel/sdk v1.14.0 // indirect
go.opentelemetry.io/otel/metric v0.37.0 // indirect
go.opentelemetry.io/otel/trace v1.14.0 // indirect
go.opentelemetry.io/proto/otlp v0.19.0 // indirect
go.uber.org/atomic v1.10.0 // indirect
go.uber.org/goleak v1.2.1 // indirect
go.uber.org/multierr v1.11.0 // indirect
go.uber.org/zap v1.24.0 // indirect
gocloud.dev v0.29.0 // indirect
Expand All @@ -129,6 +119,7 @@ require (
golang.org/x/text v0.9.0 // indirect
golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 // indirect
google.golang.org/api v0.119.0 // indirect
google.golang.org/appengine v1.6.7 // indirect
google.golang.org/genproto v0.0.0-20230410155749-daa745c078e1 // indirect
google.golang.org/grpc v1.54.1 // indirect
google.golang.org/protobuf v1.30.0 // indirect
Expand Down
Loading

0 comments on commit 2121f02

Please sign in to comment.