Skip to content

Commit

Permalink
[#1929]: feature(config plugin): deprecate env prefix
Browse files Browse the repository at this point in the history
  • Loading branch information
rustatian authored Jun 6, 2024
2 parents a049b0b + 864aa7b commit 1c1abb4
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 38 deletions.
8 changes: 4 additions & 4 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ require (
github.com/roadrunner-server/redis/v4 v4.4.2
github.com/roadrunner-server/resetter/v4 v4.3.2
github.com/roadrunner-server/rpc/v4 v4.4.2
github.com/roadrunner-server/sdk/v4 v4.7.2
github.com/roadrunner-server/sdk/v4 v4.7.3
github.com/roadrunner-server/send/v4 v4.4.2
github.com/roadrunner-server/server/v4 v4.8.2
github.com/roadrunner-server/service/v4 v4.7.2
Expand All @@ -54,11 +54,11 @@ require (
go.uber.org/automaxprocs v1.5.3
)

replace github.com/uber-go/tally/v4 => github.com/uber-go/tally/v4 v4.1.10

exclude (
github.com/spf13/viper v1.18.0
github.com/spf13/viper v1.18.1
github.com/uber-go/tally/v4 v4.1.11
github.com/uber-go/tally/v4 v4.1.12
go.temporal.io/api v1.26.1
)

Expand Down Expand Up @@ -134,7 +134,7 @@ require (
github.com/prometheus/common v0.54.0 // indirect
github.com/prometheus/procfs v0.15.1 // indirect
github.com/quic-go/qpack v0.4.0 // indirect
github.com/quic-go/quic-go v0.44.0 // indirect
github.com/quic-go/quic-go v0.45.0 // indirect
github.com/rabbitmq/amqp091-go v1.10.0 // indirect
github.com/redis/go-redis/extra/rediscmd/v9 v9.0.5 // indirect
github.com/redis/go-redis/extra/redisotel/v9 v9.0.5 // indirect
Expand Down
16 changes: 8 additions & 8 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ github.com/bsm/gomega v1.27.10 h1:yeMWxP2pV2fG3FgAODIY8EiRE3dy0aeFYt4l7wh6yKA=
github.com/bsm/gomega v1.27.10/go.mod h1:JyEr/xRbxbtgWNi8tIEVPUYZ5Dzef52k01W3YH0H+O0=
github.com/buger/goterm v1.0.4 h1:Z9YvGmOih81P0FbVtEYTFF6YsSgxSUKEhf/f9bTMXbY=
github.com/buger/goterm v1.0.4/go.mod h1:HiFWV3xnkolgrBV3mY8m0X0Pumt4zg4QhbdOzQtB8tE=
github.com/cactus/go-statsd-client/statsd v0.0.0-20200423205355-cb0885a1018c/go.mod h1:l/bIBLeOl9eX+wxJAzxS4TveKRtAqlyDpHjhkfO0MEI=
github.com/cactus/go-statsd-client/v5 v5.0.0/go.mod h1:COEvJ1E+/E2L4q6QE5CkjWPi4eeDw9maJBMIuMPBZbY=
github.com/cactus/go-statsd-client/v5 v5.1.0 h1:sbbdfIl9PgisjEoXzvXI1lwUKWElngsjJKaZeC021P4=
github.com/cactus/go-statsd-client/v5 v5.1.0/go.mod h1:COEvJ1E+/E2L4q6QE5CkjWPi4eeDw9maJBMIuMPBZbY=
github.com/caddyserver/certmagic v0.21.3 h1:pqRRry3yuB4CWBVq9+cUqu+Y6E2z8TswbhNx1AZeYm0=
Expand Down Expand Up @@ -295,8 +295,8 @@ github.com/prometheus/procfs v0.15.1 h1:YagwOFzUgYfKKHX6Dr+sHT7km/hxC76UB0leargg
github.com/prometheus/procfs v0.15.1/go.mod h1:fB45yRUv8NstnjriLhBQLuOUt+WW4BsoGhij/e3PBqk=
github.com/quic-go/qpack v0.4.0 h1:Cr9BXA1sQS2SmDUWjSofMPNKmvF6IiIfDRmgU0w1ZCo=
github.com/quic-go/qpack v0.4.0/go.mod h1:UZVnYIfi5GRk+zI9UMaCPsmZ2xKJP7XBUvVyT1Knj9A=
github.com/quic-go/quic-go v0.44.0 h1:So5wOr7jyO4vzL2sd8/pD9Kesciv91zSk8BoFngItQ0=
github.com/quic-go/quic-go v0.44.0/go.mod h1:z4cx/9Ny9UtGITIPzmPTXh1ULfOyWh4qGQlpnPcWmek=
github.com/quic-go/quic-go v0.45.0 h1:OHmkQGM37luZITyTSu6ff03HP/2IrwDX1ZFiNEhSFUE=
github.com/quic-go/quic-go v0.45.0/go.mod h1:1dLehS7TIR64+vxGR70GDcatWTOtMX2PUtnKsjbTurI=
github.com/rabbitmq/amqp091-go v1.10.0 h1:STpn5XsHlHGcecLmMFCtg7mqq0RnD+zFr4uzukfVhBw=
github.com/rabbitmq/amqp091-go v1.10.0/go.mod h1:Hy4jKW5kQART1u+JkDTF9YYOQUHXqMuhrgxOEeS7G4o=
github.com/redis/go-redis/extra/rediscmd/v9 v9.0.5 h1:EaDatTxkdHG+U3Bk4EUr+DZ7fOGwTfezUiUJMaIcaho=
Expand Down Expand Up @@ -371,8 +371,8 @@ github.com/roadrunner-server/resetter/v4 v4.3.2 h1:BYzhDUFw9agQqRzIIFjilmbHTsXoP
github.com/roadrunner-server/resetter/v4 v4.3.2/go.mod h1:skS1caYwrQYCF29sgZWN6OaZ/BFFP5ekkH4DsTeml9k=
github.com/roadrunner-server/rpc/v4 v4.4.2 h1:BOK476vpxxckyd9bKOT4Kz9PzQPhabqGRdZfri8JSl0=
github.com/roadrunner-server/rpc/v4 v4.4.2/go.mod h1:ekAQgdwQ6kAXaUfHDrAKoU4YTsKX+/NP5KO/7FnGk10=
github.com/roadrunner-server/sdk/v4 v4.7.2 h1:SjTzwfPqt1JhEA8o7goHf1/4eUnSC33evDBcbbeGlCQ=
github.com/roadrunner-server/sdk/v4 v4.7.2/go.mod h1:OteLuhqeHlU+NDlOnrEegCRj0Nmm9EqrMBwO7KXWDO4=
github.com/roadrunner-server/sdk/v4 v4.7.3 h1:w007xSk96SDFH/IJ3ZsP3AkU5opnw2/g+cBjQxd+WGA=
github.com/roadrunner-server/sdk/v4 v4.7.3/go.mod h1:pOHmaPzvxOn/xhKC9tHibHYSyNXWlUDQvp7pcRiuDGE=
github.com/roadrunner-server/send/v4 v4.4.2 h1:7qBfIlshtrYeybWcdJB++N5pAt2tlubBdvf7FEC3kSA=
github.com/roadrunner-server/send/v4 v4.4.2/go.mod h1:lHsLfBcd/gtc+J2NL/ByqgnvkFIVyq2xB5uedQGCT+g=
github.com/roadrunner-server/server/v4 v4.8.2 h1:PdB7i1UWxsoMuWJtGSX8oRCJHl5+/ssOkRS6iYE8qyk=
Expand Down Expand Up @@ -451,9 +451,8 @@ github.com/twmb/franz-go/pkg/kmsg v1.8.0/go.mod h1:HzYEb8G3uu5XevZbtU0dVbkphaKTH
github.com/twmb/murmur3 v1.1.5/go.mod h1:Qq/R7NUyOfr65zD+6Q5IHKsJLwP7exErjN6lyyq3OSQ=
github.com/twmb/murmur3 v1.1.8 h1:8Yt9taO/WN3l08xErzjeschgZU2QSrwm1kclYq+0aRg=
github.com/twmb/murmur3 v1.1.8/go.mod h1:Qq/R7NUyOfr65zD+6Q5IHKsJLwP7exErjN6lyyq3OSQ=
github.com/uber-go/tally/v4 v4.1.1/go.mod h1:aXeSTDMl4tNosyf6rdU8jlgScHyjEGGtfJ/uwCIf/vM=
github.com/uber-go/tally/v4 v4.1.17-0.20240412215630-22fe011f5ff0 h1:z5IgRoL16N7tdzn5oikX2G4oVXopW+CWo3XRxx61OQo=
github.com/uber-go/tally/v4 v4.1.17-0.20240412215630-22fe011f5ff0/go.mod h1:ZdpiHRGSa3z4NIAc1VlEH4SiknR885fOIF08xmS0gaU=
github.com/uber-go/tally/v4 v4.1.10 h1:2GSX7Tmq26wjAvOtQEc5EvRROIkX2OX4vpROt6mlRLM=
github.com/uber-go/tally/v4 v4.1.10/go.mod h1:pPR56rjthjtLB8xQlEx2I1VwAwRGCh/i4xMUcmG+6z4=
github.com/valyala/bytebufferpool v1.0.0 h1:GqA5TC/0021Y/b9FG4Oi9Mr3q7XYx6KllzawFIhcdPw=
github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc=
github.com/valyala/fasthttp v1.54.0 h1:cCL+ZZR3z3HPLMVfEYVUMtJqVaui0+gu7Lx63unHwS0=
Expand Down Expand Up @@ -530,6 +529,7 @@ go.uber.org/atomic v1.11.0/go.mod h1:LUxbIzbOniOlMKjJjyPfpl4v+PKK2cNJn91OQbhoJI0
go.uber.org/automaxprocs v1.5.3 h1:kWazyxZUrS3Gs4qUpbwo5kEIMGe/DAvi5Z4tl2NW4j8=
go.uber.org/automaxprocs v1.5.3/go.mod h1:eRbA25aqJrxAbsLO0xy5jVwPt7FQnRgjW+efnwa1WM0=
go.uber.org/goleak v1.1.10/go.mod h1:8a7PlsEVH3e/a/GLqe5IIrQx6GzcnRmZEufDUTk4A7A=
go.uber.org/goleak v1.2.1/go.mod h1:qlT2yGI9QafXHhZZLxlSuNsMw3FFLxBr+tBRlmO1xH4=
go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto=
go.uber.org/goleak v1.3.0/go.mod h1:CoHD4mav9JJNrW/WLlf7HGZPjdw8EucARQHekz1X6bE=
go.uber.org/mock v0.4.0 h1:VcM4ZOtdbR4f6VXfiOpwpVJDL6lCReaZ6mw31wqh7KU=
Expand Down
6 changes: 0 additions & 6 deletions internal/cli/serve/command.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,6 @@ import (
"github.com/spf13/cobra"
)

const (
rrPrefix string = "rr"
)

// NewCommand creates `serve` command.
func NewCommand(override *[]string, cfgFile *string, silent *bool, experimental *bool) *cobra.Command { //nolint:funlen
return &cobra.Command{
Use: "serve",
Expand All @@ -40,7 +35,6 @@ func NewCommand(override *[]string, cfgFile *string, silent *bool, experimental

cfg := &configImpl.Plugin{
Path: *cfgFile,
Prefix: rrPrefix,
Timeout: containerCfg.GracePeriod,
Flags: *override,
Version: meta.Version(),
Expand Down
3 changes: 0 additions & 3 deletions internal/rpc/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ import (
)

const (
prefix string = "rr"
rpcKey string = "rpc.listen"
// default envs
envDefault = ":-"
Expand All @@ -26,8 +25,6 @@ const (
// Client will be connected to the RPC.
func NewClient(cfg string, flags []string) (*rpc.Client, error) {
v := viper.New()
v.AutomaticEnv()
v.SetEnvPrefix(prefix)
v.SetEnvKeyReplacer(strings.NewReplacer(".", "_"))
v.SetConfigFile(cfg)

Expand Down
15 changes: 0 additions & 15 deletions internal/rpc/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,21 +66,6 @@ func TestNewClient_SuccessfullyConnectedOverride(t *testing.T) {
defer func() { assert.NoError(t, c.Close()) }()
}

func TestNewClient_SuccessfullyConnectedEnv(t *testing.T) {
l, err := net.Listen("tcp", "127.0.0.1:55556")
assert.NoError(t, err)

defer func() { assert.NoError(t, l.Close()) }()

require.NoError(t, os.Setenv("RR_RPC_LISTEN", "tcp://127.0.0.1:55556"))
c, err := rpc.NewClient("test/config_rpc_ok.yaml", nil)

assert.NotNil(t, c)
assert.NoError(t, err)

defer func() { assert.NoError(t, c.Close()) }()
}

// ${} syntax
func TestNewClient_SuccessfullyConnectedEnvDollarSyntax(t *testing.T) {
l, err := net.Listen("tcp", "127.0.0.1:55556")
Expand Down
2 changes: 0 additions & 2 deletions lib/roadrunner.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import (
)

const (
rrPrefix string = "rr"
rrModule string = "github.com/roadrunner-server/roadrunner/v2024"
)

Expand All @@ -30,7 +29,6 @@ func NewRR(cfgFile string, override []string, pluginList []any) (*RR, error) {

cfg := &configImpl.Plugin{
Path: cfgFile,
Prefix: rrPrefix,
Timeout: containerCfg.GracePeriod,
Flags: override,
Version: getRRVersion(),
Expand Down

0 comments on commit 1c1abb4

Please sign in to comment.