config

package
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 3, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Overview

Package config reads the configuration from environment variables. Invalid or contradictory settings are errors, so a misconfigured function fails at startup instead of misbehaving on a user's sign-up.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	LogLevel slog.Level

	PreSignUp         PreSignUp
	PostConfirmation  PostConfirmation
	EmailVerification EmailVerification
	SendGrid          SendGrid
}

Config is the function's configuration.

func FromEnv

func FromEnv() (*Config, error)

FromEnv reads the configuration from the process environment.

func Load

func Load(lookup func(string) (string, bool)) (*Config, error)

Load reads the configuration with lookup, which has the signature of os.LookupEnv. All problems are reported together.

type EmailVerification

type EmailVerification struct {
	Enabled bool
	// Triggers are the PreSignUp trigger sources to verify addresses for.
	Triggers []string
	// Allowlist holds domains that are treated as valid without calling
	// SendGrid.
	Allowlist []string
}

EmailVerification configures email verification for the PreSignUp hook.

type PostConfirmation

type PostConfirmation struct {
	Enabled bool
	// PolicyPath is optional; without a policy every native user's password
	// is replaced.
	PolicyPath string
}

PostConfirmation configures the PostConfirmation hook.

type PreSignUp

type PreSignUp struct {
	Enabled    bool
	PolicyPath string
}

PreSignUp configures the PreSignUp hook.

type SendGrid

type SendGrid struct {
	APIHost            string
	VerificationAPIKey string
}

SendGrid holds the SendGrid API settings.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL