diff --git a/README.md b/README.md index d4e789b..365b05a 100644 --- a/README.md +++ b/README.md @@ -18,13 +18,13 @@ These capabilities make Protty a useful tool for a variety of purposes, such as The following command will start a proxy on port 8080, and after starting, all traffic from port 8080 will be redirected to a remote host located at https://example.com ```shell -docker run -p8080:80 -e REMOTE_URI=https://example.com:443 mgerasimchuk/protty:v0.4.2 +docker run -p8080:80 -e REMOTE_URI=https://example.com:443 mgerasimchuk/protty:v0.4.3 ``` ## Running options and runtime configuration ``` -» ~ docker run -p8080:80 -it mgerasimchuk/protty:v0.4.2 /bin/sh -c 'protty start --help' +» ~ docker run -p8080:80 -it mgerasimchuk/protty:v0.4.3 /bin/sh -c 'protty start --help' Start the proxy Usage: diff --git a/go.mod b/go.mod index ce7b436..0dc0c56 100644 --- a/go.mod +++ b/go.mod @@ -3,6 +3,7 @@ module protty go 1.20 require ( + github.com/facette/natsort v0.0.0-20181210072756-2cd4dd1e2dcb github.com/graze/go-throttled v0.3.1 github.com/itchyny/gojq v0.12.11 github.com/rwtodd/Go.Sed v0.0.0-20230610052213-ba3e9c186f0a diff --git a/go.sum b/go.sum index 5b384a0..6a03892 100644 --- a/go.sum +++ b/go.sum @@ -2,6 +2,8 @@ github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46t github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/facette/natsort v0.0.0-20181210072756-2cd4dd1e2dcb h1:IT4JYU7k4ikYg1SCxNI1/Tieq/NFvh6dzLdgi7eu0tM= +github.com/facette/natsort v0.0.0-20181210072756-2cd4dd1e2dcb/go.mod h1:bH6Xx7IW64qjjJq8M2u4dxNaBiDfKK+z/3eGDpXEQhc= github.com/graze/go-throttled v0.3.1 h1:Mr9hMy0GXnbFlOWQl6pjNyn8T+9/LWIv1hJndNhs9mo= github.com/graze/go-throttled v0.3.1/go.mod h1:OYBew5YhHxQqZGjoa7M8NQLIj+ztV+Iv5xCvzK1sQLg= github.com/inconshreveable/mousetrap v1.0.1 h1:U3uMjPSQEBMNp1lFxmllqCPM6P5u/Xq7Pgzkat/bFNc= diff --git a/internal/infrastructure/config/start_command_config.go b/internal/infrastructure/config/start_command_config.go index 0fabda0..9570dd8 100644 --- a/internal/infrastructure/config/start_command_config.go +++ b/internal/infrastructure/config/start_command_config.go @@ -3,6 +3,7 @@ package config import ( "crypto/md5" "fmt" + "github.com/facette/natsort" "github.com/sirupsen/logrus" "net/http" "net/url" @@ -68,7 +69,9 @@ func (c *StartCommandConfig) SetFromEnv() error { if optValueField.Kind() == reflect.Slice { envValuesSlice := []string{} - for _, envPair := range os.Environ() { + sortedEnviron := os.Environ() + natsort.Sort(sortedEnviron) + for _, envPair := range sortedEnviron { envPairSlice := strings.Split(envPair, "=") eName, eVal := envPairSlice[0], envPairSlice[1] if isMatch, _ := regexp.MatchString(envName+`(_\d+)?$`, eName); isMatch {