diff --git a/cmd/root.go b/cmd/root.go index 92b973c8b16..ac696459dff 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -16,8 +16,6 @@ import ( "github.com/ory/x/logrusx" "github.com/spf13/cobra" - - "github.com/ory/hive/driver/configuration" ) var logger *logrus.Logger @@ -46,11 +44,7 @@ func init() { cobra.OnInitialize(func() { viperx.InitializeConfig("hive", "", nil) - configuration.BindEnvs() - - if logger == nil { - logger = logrusx.New() - } + logger = logrusx.New() if err := viperx.Validate(gojsonschema.NewBytesLoader(schema)); err != nil { viperx.LoggerWithValidationErrorFields(logger, err). diff --git a/driver/configuration/provider_viper.go b/driver/configuration/provider_viper.go index e0b3670e827..c395ba34a49 100644 --- a/driver/configuration/provider_viper.go +++ b/driver/configuration/provider_viper.go @@ -64,38 +64,6 @@ const ( ViperKeyHasherArgon2ConfigKeyLength = "hashers.argon2.key_length" ) -func BindEnvs() { - if err := viper.BindEnv( - ViperKeyURLsSelfPublic, - ViperKeyURLsSelfAdmin, - ViperKeyURLsLogin, - ViperKeyURLsError, - ViperKeyURLsMFA, - ViperKeyURLsRegistration, - ViperKeyURLsWhitelistedReturnToDomains, - ViperKeyDSN, - ViperKeySecretsSession, - ViperKeySelfServiceLifespanRegistrationRequest, - ViperKeySelfServiceLifespanLoginRequest, - ViperKeyLifespanSession, - ViperKeySelfServiceStrategyConfig, - ViperKeyDefaultIdentityTraitsSchemaURL, - ViperKeyHasherArgon2ConfigMemory, - ViperKeyHasherArgon2ConfigIterations, - ViperKeyHasherArgon2ConfigParallelism, - ViperKeyHasherArgon2ConfigSaltLength, - ViperKeyHasherArgon2ConfigKeyLength, - ViperKeySelfServiceLoginBeforeConfig, - ViperKeySelfServiceRegistrationBeforeConfig, - ViperKeySelfServiceRegistrationAfterConfig, - ViperKeySelfServiceLoginAfterConfig, - ViperKeySelfServiceLogoutRedirectURL, - ViperKeyURLsDefaultReturnTo, - ); err != nil { - panic(err.Error()) - } -} - func NewViperProvider(l logrus.FieldLogger) *ViperProvider { return &ViperProvider{ l: l, diff --git a/driver/configuration/provider_viper_test.go b/driver/configuration/provider_viper_test.go index 6495ee70804..37e3057857b 100644 --- a/driver/configuration/provider_viper_test.go +++ b/driver/configuration/provider_viper_test.go @@ -19,7 +19,6 @@ import ( func TestViperProvider(t *testing.T) { t.Run("suite=loaders", func(t *testing.T) { viper.Reset() - BindEnvs() viperx.InitializeConfig( "hive", "./../../docs/", diff --git a/go.mod b/go.mod index 05efc4d126a..461db70d9f0 100644 --- a/go.mod +++ b/go.mod @@ -45,7 +45,7 @@ require ( github.com/ory/graceful v0.1.1 github.com/ory/herodot v0.6.2 github.com/ory/viper v1.5.6 - github.com/ory/x v0.0.76 + github.com/ory/x v0.0.80 github.com/pelletier/go-toml v1.5.0 // indirect github.com/phayes/freeport v0.0.0-20180830031419-95f893ade6f2 github.com/pkg/errors v0.8.1 @@ -57,14 +57,11 @@ require ( github.com/sqs/goreturns v0.0.0-20181028201513-538ac6014518 github.com/stretchr/testify v1.4.0 github.com/subosito/gotenv v1.2.0 // indirect - github.com/tidwall/gjson v1.2.1 - github.com/tidwall/match v1.0.1 // indirect - github.com/tidwall/pretty v0.0.0-20190325153808-1166b9ac2b65 // indirect + github.com/tidwall/gjson v1.3.2 github.com/tidwall/sjson v1.0.4 github.com/toqueteos/webbrowser v1.1.0 // indirect github.com/urfave/negroni v1.0.0 github.com/xeipuuv/gojsonpointer v0.0.0-20190905194746-02993c407bfb // indirect - github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415 // indirect golang.org/x/crypto v0.0.0-20190701094942-4def268fd1a4 golang.org/x/net v0.0.0-20191014212845-da9a3fd4c582 // indirect golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45 diff --git a/go.sum b/go.sum index 4388c13f5e2..5c8cf49d313 100644 --- a/go.sum +++ b/go.sum @@ -470,6 +470,7 @@ github.com/mattn/go-runewidth v0.0.4/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzp github.com/mattn/go-sqlite3 v1.9.0/go.mod h1:FPy6KqzDD04eiIsT53CuJW3U88zkxoIYsOqkbpncsNc= github.com/mattn/go-sqlite3 v1.10.0 h1:jbhqpg7tQe4SupckyijYiy0mJJ/pRyHvXf7JdWK860o= github.com/mattn/go-sqlite3 v1.10.0/go.mod h1:FPy6KqzDD04eiIsT53CuJW3U88zkxoIYsOqkbpncsNc= +github.com/mattn/go-sqlite3 v1.11.0 h1:LDdKkqtYlom37fkvqs8rMPFKAMe8+SgjbwZ6ex1/A/Q= github.com/mattn/go-sqlite3 v1.11.0/go.mod h1:FPy6KqzDD04eiIsT53CuJW3U88zkxoIYsOqkbpncsNc= github.com/mattn/goveralls v0.0.2 h1:7eJB6EqsPhRVxvwEXGnqdO2sJI0PTsrWoTMXEk9/OQc= github.com/mattn/goveralls v0.0.2/go.mod h1:8d1ZMHsd7fW6IRPKQh46F2WRpyib5/X4FOpevwGNQEw= @@ -515,7 +516,6 @@ github.com/ory/go-convenience v0.1.0 h1:zouLKfF2GoSGnJwGq+PE/nJAE6dj2Zj5QlTgmMTs github.com/ory/go-convenience v0.1.0/go.mod h1:uEY/a60PL5c12nYz4V5cHY03IBmwIAEm8TWB0yn9KNs= github.com/ory/gojsonreference v0.0.0-20190720135523-6b606c2d8ee8 h1:e2S2FmxqSbhFyVNP24HncpRY+X1qAZmtE3nZ0gJKR4Q= github.com/ory/gojsonreference v0.0.0-20190720135523-6b606c2d8ee8/go.mod h1:wsH1C4nIeeQClDtD5AH7kF1uTS6zWyqfjVDTmB0Em7A= -github.com/ory/gojsonschema v0.0.0-20190717132251-f184856edacf/go.mod h1:ypRRv2Fg8r46Xc3bGggOPzwzJFN2CiW7roiJN5k/p4w= github.com/ory/gojsonschema v1.1.1-0.20190919112458-f254ca73d5e9/go.mod h1:BNZpdJgB74KOLSsWFvzw6roXg1I6O51WO8roMmW+T7Y= github.com/ory/gojsonschema v1.2.0 h1:ePsM9vnsxVHrEHW9/bE2DyU4s34B/YdDtT4LoPnGNso= github.com/ory/gojsonschema v1.2.0/go.mod h1:BNZpdJgB74KOLSsWFvzw6roXg1I6O51WO8roMmW+T7Y= @@ -526,10 +526,8 @@ github.com/ory/herodot v0.6.2 h1:zOb5MsuMn7AH9/Ewc/EK83yqcNViK1m1l3C2UuP3RcA= github.com/ory/herodot v0.6.2/go.mod h1:3BOneqcyBsVybCPAJoi92KN2BpJHcmDqAMcAAaJiJow= github.com/ory/viper v1.5.6 h1:w4ceGgWwWLzAFYQ7bHaDZmwNsAto2JPVdyQjQnn7VWI= github.com/ory/viper v1.5.6/go.mod h1:TYmpFpKLxjQwvT4f0QPpkOn4sDXU1kDgAwJpgLYiQ28= -github.com/ory/x v0.0.72 h1:wFYrdJe5cl9D5FFdjbFeuJkrR5NeWUsg1OGV87IhTBs= -github.com/ory/x v0.0.72/go.mod h1:7v4dBrNrHPO3jFur5lCqhLlBw5lIQEMJZ5uQPJC67oI= -github.com/ory/x v0.0.76 h1:pM9oK8szqYr/tAa0I/oGiCRVGppt4pJSm56oQUnjsvM= -github.com/ory/x v0.0.76/go.mod h1:TH1ImNLBepjywXHy3fgEXDgOIxH+ZF95jkZuo4/lPEU= +github.com/ory/x v0.0.80 h1:Gv8puLh2Yn3cyx0k9vweQSfoR+xwgQAPQotkqX43Rjo= +github.com/ory/x v0.0.80/go.mod h1:WVlPrVNe4wtPfdXqE6B+x7a7xoTR2EFGIGxZTPdAuxw= github.com/parnurzeal/gorequest v0.2.15/go.mod h1:3Kh2QUMJoqw3icWAecsyzkpY7UzRfDhbRdTjtNwNiUE= github.com/pborman/uuid v1.2.0 h1:J7Q5mO4ysT1dv8hyrUGHb9+ooztCXu1D8MY8DZYsu3g= github.com/pborman/uuid v1.2.0/go.mod h1:X/NO0urCmaxf9VXbdlT7C2Yzkj2IKimNn4k+gtPdI/k= @@ -613,9 +611,8 @@ github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= github.com/spf13/viper v1.2.1/go.mod h1:P4AexN0a+C9tGAnUFNwDMYYZv3pjFuvmeiMyKRaNVlI= github.com/spf13/viper v1.3.1/go.mod h1:ZiWeW+zYFKm7srdB9IoDzzZXaJaI5eL9QjNiN/DMA2s= +github.com/spf13/viper v1.3.2 h1:VUFqw5KcqRf7i70GOzW7N+Q7+gxVBkSSqiXB12+JQ4M= github.com/spf13/viper v1.3.2/go.mod h1:ZiWeW+zYFKm7srdB9IoDzzZXaJaI5eL9QjNiN/DMA2s= -github.com/spf13/viper v1.4.0 h1:yXHLWeravcrgGyFSyCgdYpXQ9dR9c/WED3pg1RhxqEU= -github.com/spf13/viper v1.4.0/go.mod h1:PTJ7Z/lr49W6bUbkmS1V3by4uWynFiR9p7+dSq/yZzE= github.com/sqs/goreturns v0.0.0-20181028201513-538ac6014518 h1:iD+PFTQwKEmbwSdwfvP5ld2WEI/g7qbdhmHJ2ASfYGs= github.com/sqs/goreturns v0.0.0-20181028201513-538ac6014518/go.mod h1:CKI4AZ4XmGV240rTHfO0hfE83S6/a3/Q1siZJ/vXf7A= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= @@ -629,12 +626,12 @@ github.com/subosito/gotenv v1.1.1 h1:TWxckSF6WVKWbo2M3tMqCtWa9NFUgqM1SSynxmYONOI github.com/subosito/gotenv v1.1.1/go.mod h1:N0PQaV/YGNqwC0u51sEeR/aUtSLEXKX9iv69rRypqCw= github.com/subosito/gotenv v1.2.0 h1:Slr1R9HxAlEKefgq5jn9U+DnETlIUa6HfgEzj0g5d7s= github.com/subosito/gotenv v1.2.0/go.mod h1:N0PQaV/YGNqwC0u51sEeR/aUtSLEXKX9iv69rRypqCw= -github.com/tidwall/gjson v1.2.1 h1:j0efZLrZUvNerEf6xqoi0NjWMK5YlLrR7Guo/dxY174= -github.com/tidwall/gjson v1.2.1/go.mod h1:c/nTNbUr0E0OrXEhq1pwa8iEgc2DOt4ZZqAt1HtCkPA= +github.com/tidwall/gjson v1.3.2 h1:+7p3qQFaH3fOMXAJSrdZwGKcOO/lYdGS0HqGhPqDdTI= +github.com/tidwall/gjson v1.3.2/go.mod h1:P256ACg0Mn+j1RXIDXoss50DeIABTYK1PULOJHhxOls= github.com/tidwall/match v1.0.1 h1:PnKP62LPNxHKTwvHHZZzdOAOCtsJTjo6dZLCwpKm5xc= github.com/tidwall/match v1.0.1/go.mod h1:LujAq0jyVjBy028G1WhWfIzbpQfMO8bBZ6Tyb0+pL9E= -github.com/tidwall/pretty v0.0.0-20190325153808-1166b9ac2b65 h1:rQ229MBgvW68s1/g6f1/63TgYwYxfF4E+bi/KC19P8g= -github.com/tidwall/pretty v0.0.0-20190325153808-1166b9ac2b65/go.mod h1:XNkn88O1ChpSDQmQeStsy+sBenx6DDtFZJxhVysOjyk= +github.com/tidwall/pretty v1.0.0 h1:HsD+QiTn7sK6flMKIvNmpqz1qrpP3Ps6jOKIKMooyg4= +github.com/tidwall/pretty v1.0.0/go.mod h1:XNkn88O1ChpSDQmQeStsy+sBenx6DDtFZJxhVysOjyk= github.com/tidwall/sjson v1.0.4 h1:UcdIRXff12Lpnu3OLtZvnc03g4vH2suXDXhBwBqmzYg= github.com/tidwall/sjson v1.0.4/go.mod h1:bURseu1nuBkFpIES5cz6zBtjmYeOQmEESshn7VpF15Y= github.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= @@ -656,8 +653,6 @@ github.com/xeipuuv/gojsonpointer v0.0.0-20180127040702-4e3ac2762d5f h1:J9EGpcZtP github.com/xeipuuv/gojsonpointer v0.0.0-20180127040702-4e3ac2762d5f/go.mod h1:N2zxlSyiKSe5eX1tZViRH5QA0qijqEDrYZiPEAiq3wU= github.com/xeipuuv/gojsonpointer v0.0.0-20190905194746-02993c407bfb h1:zGWFAtiMcyryUHoUjUJX0/lt1H2+i2Ka2n+D3DImSNo= github.com/xeipuuv/gojsonpointer v0.0.0-20190905194746-02993c407bfb/go.mod h1:N2zxlSyiKSe5eX1tZViRH5QA0qijqEDrYZiPEAiq3wU= -github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415 h1:EzJWgHovont7NscjpAxXsDA8S8BMYve8Y5+7cuRE7R0= -github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415/go.mod h1:GwrjFmJcFw6At/Gs6z4yjiIwzuJ1/+UwLxMQDVQXShQ= github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU= github.com/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77/go.mod h1:aYKd//L2LvnjZzWKhF00oedf4jCCReLcmhLdhm1A27Q= github.com/xtgo/uuid v0.0.0-20140804021211-a0b114877d4c h1:3lbZUMbMiGUW/LMkfsEABsc5zNT9+b1CvsJx47JzJ8g=