@@ -18,30 +18,29 @@ import (
1818 "testing"
1919 "time"
2020
21- "go.opentelemetry.io/otel/trace/noop"
22-
23- "github.com/ory/x/crdbx"
24- "github.com/ory/x/pointerx"
25-
2621 "github.com/go-webauthn/webauthn/protocol"
2722 "github.com/go-webauthn/webauthn/webauthn"
2823 "github.com/gofrs/uuid"
2924 "github.com/inhies/go-bytesize"
3025 "github.com/pkg/errors"
3126 "github.com/rs/cors"
3227 "github.com/stretchr/testify/require"
28+ "go.opentelemetry.io/otel/trace/noop"
3329 "golang.org/x/net/publicsuffix"
3430
3531 "github.com/ory/herodot"
3632 "github.com/ory/jsonschema/v3"
3733 "github.com/ory/jsonschema/v3/httploader"
3834 "github.com/ory/kratos/embedx"
35+ "github.com/ory/kratos/request"
3936 "github.com/ory/x/configx"
4037 "github.com/ory/x/contextx"
38+ "github.com/ory/x/crdbx"
4139 "github.com/ory/x/httpx"
4240 "github.com/ory/x/jsonschemax"
4341 "github.com/ory/x/logrusx"
4442 "github.com/ory/x/otelx"
43+ "github.com/ory/x/pointerx"
4544 "github.com/ory/x/stringsx"
4645 "github.com/ory/x/tlsx"
4746 "github.com/ory/x/watcherx"
@@ -286,11 +285,10 @@ type (
286285 PlainText string `json:"plaintext"`
287286 }
288287 CourierChannel struct {
289- ID string `json:"id" koanf:"id"`
290- Type string `json:"type" koanf:"type"`
291- SMTPConfig * SMTPConfig `json:"smtp_config" koanf:"smtp_config"`
292- RequestConfig json.RawMessage `json:"request_config" koanf:"-"`
293- RequestConfigRaw map [string ]any `json:"-" koanf:"request_config"`
288+ ID string `json:"id" koanf:"id"`
289+ Type string `json:"type" koanf:"type"`
290+ SMTPConfig * SMTPConfig `json:"smtp_config" koanf:"smtp_config"`
291+ RequestConfig request.Config `json:"request_config" koanf:"request_config"`
294292 }
295293 SMTPConfig struct {
296294 ConnectionURI string `json:"connection_uri" koanf:"connection_uri"`
@@ -302,8 +300,8 @@ type (
302300 LocalName string `json:"local_name" koanf:"local_name"`
303301 }
304302 PasswordMigrationHook struct {
305- Enabled bool `json:"enabled" koanf:"enabled"`
306- Config json. RawMessage `json:"config" koanf:"config"`
303+ Enabled bool `json:"enabled" koanf:"enabled"`
304+ Config request. Config `json:"config" koanf:"config"`
307305 }
308306 Config struct {
309307 l * logrusx.Logger
@@ -1238,17 +1236,6 @@ func (p *Config) CourierChannels(ctx context.Context) (ccs []*CourierChannel, _
12381236 if err := p .GetProvider (ctx ).Koanf .Unmarshal (ViperKeyCourierChannels , & ccs ); err != nil {
12391237 return nil , errors .WithStack (err )
12401238 }
1241- if len (ccs ) != 0 {
1242- for _ , c := range ccs {
1243- if c .RequestConfigRaw != nil {
1244- var err error
1245- c .RequestConfig , err = json .Marshal (c .RequestConfigRaw )
1246- if err != nil {
1247- return nil , errors .WithStack (err )
1248- }
1249- }
1250- }
1251- }
12521239
12531240 // load legacy configs
12541241 channel := CourierChannel {
@@ -1260,9 +1247,7 @@ func (p *Config) CourierChannels(ctx context.Context) (ccs []*CourierChannel, _
12601247 return nil , errors .WithStack (err )
12611248 }
12621249 } else {
1263- var err error
1264- channel .RequestConfig , err = json .Marshal (p .GetProvider (ctx ).Get (ViperKeyCourierHTTPRequestConfig ))
1265- if err != nil {
1250+ if err := p .GetProvider (ctx ).Koanf .Unmarshal (ViperKeyCourierHTTPRequestConfig , & channel .RequestConfig ); err != nil {
12661251 return nil , errors .WithStack (err )
12671252 }
12681253 }
@@ -1687,7 +1672,7 @@ func (p *Config) PasswordMigrationHook(ctx context.Context) *PasswordMigrationHo
16871672 return hook
16881673 }
16891674
1690- hook . Config , _ = json . Marshal ( p .GetProvider (ctx ).Get (ViperKeyPasswordMigrationHook + ".config" ) )
1675+ _ = p .GetProvider (ctx ).Unmarshal (ViperKeyPasswordMigrationHook + ".config" , & hook . Config )
16911676
16921677 return hook
16931678}
0 commit comments