Skip to content
Snippets Groups Projects
Commit a747e2ea1c93 authored by Christophe de Vienne's avatar Christophe de Vienne
Browse files

cmd: add Redner support

parent 22c9516be333
No related branches found
No related tags found
No related merge requests found
Pipeline #118463 failed
......@@ -51,6 +51,7 @@
TokenOptions *auth.TokenOptions
DatabaseOptions database.Options
XbusOptions XbusOptions
RednerOptions RednerOptions
Ext E
......
package cmd
import (
redner "orus.io/orus-io/go-redner/client"
)
type RednerOptions struct {
NoSSL bool `long:"no-ssl" ini-name:"no-ssl" description:"disable ssl"`
Host string `long:"host" ini-name:"host" description:"Redner host"`
APIKey string `long:"api-key" ini-name:"api-key" description:"Redner api-key"`
Account string `long:"account" ini-name:"account" description:"Redner account name"`
client *redner.Redner
}
func (options *RednerOptions) Client() *redner.Redner {
if options.client == nil && options.Host != "" {
schemes := []string{"https"}
if options.NoSSL {
schemes = []string{"http"}
}
options.client = redner.NewHTTPClientWithConfig(
nil,
redner.DefaultTransportConfig().WithHost(options.Host).WithSchemes(schemes),
)
options.client.SetAPIKey(options.APIKey)
}
return options.client
}
func WithRedner[E any]() Option[E] {
return func(program *Program[E]) {
g, err := program.Parser.AddGroup("Redner", "Redner options", &program.RednerOptions)
if err != nil {
panic(err)
}
g.Namespace = "redner"
g.EnvNamespace = "REDNER"
}
}
func (program *Program[E]) Redner() *redner.Redner {
return program.RednerOptions.Client()
}
......@@ -5,6 +5,7 @@
require (
github.com/Masterminds/squirrel v1.5.4
github.com/fatih/structtag v1.2.0
github.com/getkin/kin-openapi v0.128.0
github.com/getsentry/sentry-go v0.24.1
github.com/go-openapi/runtime v0.26.0
github.com/go-openapi/swag v0.23.0
......@@ -19,5 +20,6 @@
github.com/prometheus/client_golang v1.17.0
github.com/rs/zerolog v1.31.0
github.com/stretchr/testify v1.9.0
github.com/timewasted/go-accept-headers v0.0.0-20130320203746-c78f304b1b09
golang.org/x/net v0.15.0
golang.org/x/term v0.12.0
......@@ -22,7 +24,9 @@
golang.org/x/net v0.15.0
golang.org/x/term v0.12.0
gopkg.in/dgrijalva/jwt-go.v3 v3.2.0
orus.io/orus-io/go-redner v0.0.0-20240212152601-2bd8ade04023
orus.io/xbus/xbus-stdlib v1.3.3
xbus.io/go-xbus/v4 v4.0.0-20230823140355-edd2d56a84db
)
require (
......@@ -24,8 +28,9 @@
orus.io/xbus/xbus-stdlib v1.3.3
xbus.io/go-xbus/v4 v4.0.0-20230823140355-edd2d56a84db
)
require (
github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2 // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/cespare/xxhash/v2 v2.2.0 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
......@@ -29,5 +34,6 @@
github.com/beorn7/perks v1.0.1 // indirect
github.com/cespare/xxhash/v2 v2.2.0 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/dgrijalva/jwt-go v3.2.0+incompatible // indirect
github.com/docker/go-units v0.5.0 // indirect
github.com/fsnotify/fsnotify v1.6.0 // indirect
......@@ -32,4 +38,7 @@
github.com/docker/go-units v0.5.0 // indirect
github.com/fsnotify/fsnotify v1.6.0 // indirect
github.com/getkin/kin-openapi v0.128.0 // indirect
github.com/go-logr/logr v1.2.3 // indirect
github.com/go-logr/stdr v1.2.2 // indirect
github.com/go-openapi/analysis v0.21.4 // indirect
github.com/go-openapi/errors v0.20.3 // indirect
github.com/go-openapi/jsonpointer v0.21.0 // indirect
......@@ -35,4 +44,9 @@
github.com/go-openapi/jsonpointer v0.21.0 // indirect
github.com/go-openapi/jsonreference v0.20.0 // indirect
github.com/go-openapi/loads v0.21.2 // indirect
github.com/go-openapi/spec v0.20.8 // indirect
github.com/go-openapi/strfmt v0.21.7 // indirect
github.com/go-openapi/validate v0.22.1 // indirect
github.com/golang/protobuf v1.5.3 // indirect
github.com/hashicorp/errwrap v1.1.0 // indirect
github.com/hashicorp/go-multierror v1.1.1 // indirect
......@@ -58,6 +72,8 @@
github.com/nats-io/nuid v1.0.1 // indirect
github.com/nats-rpc/nrpc v0.0.0-20230331165850-dd9d3cdece2a // indirect
github.com/nightlyone/lockfile v1.0.0 // indirect
github.com/oklog/ulid v1.3.1 // indirect
github.com/opentracing/opentracing-go v1.2.0 // indirect
github.com/pelletier/go-toml/v2 v2.1.0 // indirect
github.com/perimeterx/marshmallow v1.1.5 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
......@@ -71,9 +87,11 @@
github.com/spf13/pflag v1.0.5 // indirect
github.com/spf13/viper v1.16.0 // indirect
github.com/subosito/gotenv v1.6.0 // indirect
github.com/timewasted/go-accept-headers v0.0.0-20130320203746-c78f304b1b09 // indirect
go.mongodb.org/mongo-driver v1.11.3 // indirect
go.opentelemetry.io/otel v1.14.0 // indirect
go.opentelemetry.io/otel/trace v1.14.0 // indirect
go.uber.org/atomic v1.11.0 // indirect
golang.org/x/crypto v0.13.0 // indirect
golang.org/x/sys v0.21.0 // indirect
golang.org/x/text v0.13.0 // indirect
google.golang.org/protobuf v1.31.0 // indirect
......@@ -75,9 +93,8 @@
go.uber.org/atomic v1.11.0 // indirect
golang.org/x/crypto v0.13.0 // indirect
golang.org/x/sys v0.21.0 // indirect
golang.org/x/text v0.13.0 // indirect
google.golang.org/protobuf v1.31.0 // indirect
gopkg.in/dgrijalva/jwt-go.v3 v3.2.0 // indirect
gopkg.in/ini.v1 v1.67.0 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
......
This diff is collapsed.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment