Documentation ¶
Index ¶
- Variables
- func CreateKeysIfNotExists(ctx context.Context, store storage.Storage) (keys []jwkset.JWK, existed bool, err error)
- func CreateLogger(srvConf config.Config) *slog.Logger
- func CreateMultiProviderServer(ctx context.Context, conf MultiConfig, options ServerOptions) (*handle.Server, error)
- func CreateNopProviderServer(ctx context.Context, conf NopConfig, options ServerOptions) (*handle.Server, error)
- func CreateSESProvider(ctx context.Context, conf SESConfig, options ServerOptions) (*handle.Server, error)
- func CreateSendGridProvider(ctx context.Context, conf SendGridConfig, options ServerOptions) (*handle.Server, error)
- func CreateServer(ctx context.Context, conf config.Config, options ServerOptions, ...) (*handle.Server, error)
- func CreateTestingProvider(ctx context.Context, conf TestConfig, options ServerOptions) (*handle.Server, error)
- func MagicLinkErrorHandler(h magiclink.ErrorHandler) magiclink.ErrorHandler
- func RunServer(ctx context.Context, logger *slog.Logger, server *handle.Server)
- type MultiConfig
- type NopConfig
- type SESConfig
- type SendGridConfig
- type ServerInterfaces
- type ServerOptions
- type TestConfig
Constants ¶
This section is empty.
Variables ¶
var ErrJWKSet = errors.New("JWK Set did not align with setup expectations")
ErrJWKSet is returned when the JWK Set does not align with setup expectations.
Functions ¶
func CreateKeysIfNotExists ¶
func CreateKeysIfNotExists(ctx context.Context, store storage.Storage) (keys []jwkset.JWK, existed bool, err error)
CreateKeysIfNotExists creates the keys if they do not exist.
func CreateMultiProviderServer ¶
func CreateMultiProviderServer(ctx context.Context, conf MultiConfig, options ServerOptions) (*handle.Server, error)
CreateMultiProviderServer creates a new magiclinksdev server with multiple email providers.
func CreateNopProviderServer ¶
func CreateNopProviderServer(ctx context.Context, conf NopConfig, options ServerOptions) (*handle.Server, error)
CreateNopProviderServer creates a new magiclinksdev server with a no-operation email provider.
func CreateSESProvider ¶
func CreateSESProvider(ctx context.Context, conf SESConfig, options ServerOptions) (*handle.Server, error)
CreateSESProvider creates a new magiclinksdev server with a SES email provider.
func CreateSendGridProvider ¶
func CreateSendGridProvider(ctx context.Context, conf SendGridConfig, options ServerOptions) (*handle.Server, error)
CreateSendGridProvider creates a new magiclinksdev server with a SendGrid email provider.
func CreateServer ¶
func CreateServer(ctx context.Context, conf config.Config, options ServerOptions, interfaces ServerInterfaces) (*handle.Server, error)
CreateServer creates a new magiclinksdev server.
func CreateTestingProvider ¶
func CreateTestingProvider(ctx context.Context, conf TestConfig, options ServerOptions) (*handle.Server, error)
CreateTestingProvider creates a new magiclinksdev server with a testing email provider.
func MagicLinkErrorHandler ¶
func MagicLinkErrorHandler(h magiclink.ErrorHandler) magiclink.ErrorHandler
MagicLinkErrorHandler is a wrapper for magiclink.ErrorHandlerFunc.
Types ¶
type MultiConfig ¶
type MultiConfig struct { SES ses.Config `json:"ses"` SendGrid sendgrid.Config `json:"sendgrid"` Server config.Config `json:"server"` Storage storage.Config `json:"storage"` RateLimiter rlimit.Config `json:"rateLimiter"` }
MultiConfig is the configuration for a multiple email provider magiclinksdev server.
func (MultiConfig) DefaultsAndValidate ¶
func (m MultiConfig) DefaultsAndValidate() (MultiConfig, error)
DefaultsAndValidate implements the jsontype.Config interface.
type NopConfig ¶
type NopConfig struct { Server config.Config `json:"server"` Storage storage.Config `json:"storage"` RateLimiter rlimit.Config `json:"rateLimiter"` }
NopConfig is the configuration for a no-operation email provider magiclinksdev server.
func (NopConfig) DefaultsAndValidate ¶
DefaultsAndValidate implements the jsontype.Config interface.
type SESConfig ¶
type SESConfig struct { SES ses.Config `json:"ses"` Server config.Config `json:"server"` Storage storage.Config `json:"storage"` RateLimiter rlimit.Config `json:"rateLimiter"` }
SESConfig is the configuration for a single email provider magiclinksdev server.
func (SESConfig) DefaultsAndValidate ¶
DefaultsAndValidate implements the jsontype.Config interface.
type SendGridConfig ¶
type SendGridConfig struct { SendGrid sendgrid.Config `json:"sendgrid"` Server config.Config `json:"server"` Storage storage.Config `json:"storage"` RateLimiter rlimit.Config `json:"rateLimiter"` }
SendGridConfig is the configuration for the SendGrid email provider.
func (SendGridConfig) DefaultsAndValidate ¶
func (m SendGridConfig) DefaultsAndValidate() (SendGridConfig, error)
DefaultsAndValidate implements the jsontype.Config interface.
type ServerInterfaces ¶
type ServerInterfaces struct { EmailProvider email.Provider RateLimiter rlimit.RateLimiter Store storage.Storage }
ServerInterfaces holds all the interface implementations needed for a magiclinksdev server.
type ServerOptions ¶
type ServerOptions struct { HTTPMux *http.ServeMux Logger *slog.Logger MagicLinkErrorHandler magiclink.ErrorHandler MiddlewareHook handle.MiddlewareHook }
ServerOptions holds all the options for a magiclinksdev server.
func (ServerOptions) ApplyDefaults ¶
func (o ServerOptions) ApplyDefaults() ServerOptions
ApplyDefaults applies the default values to the options.
type TestConfig ¶
type TestConfig struct { Server config.Config `json:"server"` Storage storage.Config `json:"storage"` RateLimiter rlimit.Config `json:"rateLimiter"` }
TestConfig is the configuration for a test magiclinksdev server.
func (TestConfig) DefaultsAndValidate ¶
func (t TestConfig) DefaultsAndValidate() (TestConfig, error)
DefaultsAndValidate implements the jsontype.Config interface.