Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Config ¶
type Config struct {
Port int `mapstructure:"PORT"`
Env string `mapstructure:"ENV"`
JWTSecret string `mapstructure:"JWT_SECRET"`
JWTTokenDuration time.Duration `mapstructure:"JWT_TOKEN_DURATION"`
JWTRefreshTokenDuration time.Duration `mapstructure:"JWT_REFRESH_TOKEN_DURATION"`
MagicLinkTokenDuration time.Duration `mapstructure:"MAGIC_LINK_TOKEN_DURATION"`
DatabaseURL string `mapstructure:"DATABASE_URL"`
DatabaseLogLevel string `mapstructure:"DATABASE_LOG_LEVEL"`
DatabaseMaxIdleConns int `mapstructure:"DATABASE_MAX_IDLE_CONNS"`
DatabaseMaxOpenConns int `mapstructure:"DATABASE_MAX_OPEN_CONNS"`
DatabaseConnMaxLifetime time.Duration `mapstructure:"DATABASE_CONN_MAX_LIFETIME"`
AppBaseURL string `mapstructure:"APP_BASE_URL"`
FreeNoteLimit int `mapstructure:"FREE_NOTE_LIMIT"`
RateLimitPerMinute int `mapstructure:"RATE_LIMIT_PER_MINUTE"`
RateLimitBurst int `mapstructure:"RATE_LIMIT_BURST"`
ResendAPIKey string `mapstructure:"RESEND_API_KEY"`
EmailFrom string `mapstructure:"EMAIL_FROM"`
// CORSAllowedOrigins is a comma-separated list of origins the server will
// reflect in Access-Control-Allow-Origin responses. Set via CORS_ALLOWED_ORIGINS.
// Use ParsedCORSOrigins() to obtain the split slice for use in middleware.
CORSAllowedOrigins string `mapstructure:"CORS_ALLOWED_ORIGINS"`
// MaxRequestBody is the maximum size of an incoming request body, expressed
// in Echo's BodyLimit format (e.g. "1M", "512K"). Requests exceeding this
// size are rejected with HTTP 413 before the handler is invoked.
MaxRequestBody string `mapstructure:"MAX_REQUEST_BODY"`
// PostHog telemetry. When POSTHOG_API_KEY is set the logging package
// forwards warn-and-above log entries to PostHog as "server.log" events.
// POSTHOG_ENDPOINT overrides the default US endpoint — set to
// https://eu.i.posthog.com for EU data residency.
// Both fields are optional; omitting them disables PostHog forwarding.
PostHogAPIKey string `mapstructure:"POSTHOG_API_KEY"`
PostHogEndpoint string `mapstructure:"POSTHOG_ENDPOINT"`
// Billing / Stripe. All fields are optional unless BillingEnabled is true,
// in which case Validate() requires the Stripe secrets and the Resend key.
BillingEnabled bool `mapstructure:"BILLING_ENABLED"`
StripeSecretKey string `mapstructure:"STRIPE_SECRET_KEY"`
StripeWebhookSecret string `mapstructure:"STRIPE_WEBHOOK_SECRET"`
StripePriceID string `mapstructure:"STRIPE_PRICE_ID"`
StripeSuccessURL string `mapstructure:"STRIPE_SUCCESS_URL"`
StripeCancelURL string `mapstructure:"STRIPE_CANCEL_URL"`
}
func (*Config) IsDevelopment ¶
func (*Config) IsProduction ¶ added in v0.4.1
func (*Config) MaxRequestBodyBytes ¶ added in v0.4.1
MaxRequestBodyBytes parses the human-readable MAX_REQUEST_BODY string into bytes as int64. Supported suffixes are K (kibibytes), M (mebibytes), and G (gibibytes); a bare integer is treated as bytes. Multiplier constants come from Echo's middleware package so we stay in sync with how Echo itself counts. Parsing errors fall back silently to 1 MiB so a misconfigured value never brings the server down.
func (*Config) ParsedCORSOrigins ¶ added in v0.4.1
ParsedCORSOrigins splits the comma-separated CORS_ALLOWED_ORIGINS value into a slice of trimmed, non-empty origin strings ready for use in Echo's CORS middleware. Returns nil when the raw value is empty.
Click to show internal directories.
Click to hide internal directories.