Documentation
¶
Index ¶
- type BlobConfig
- type DBConfig
- type JWTConfig
- type KVConfig
- type MailerConfig
- func (cfg *MailerConfig) WithFrom(from string) *MailerConfig
- func (cfg *MailerConfig) WithHost(host string) *MailerConfig
- func (cfg *MailerConfig) WithPassword(password string) *MailerConfig
- func (cfg *MailerConfig) WithPort(port string) *MailerConfig
- func (cfg *MailerConfig) WithUsername(username string) *MailerConfig
- type OAuthConfig
- type PaymentConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BlobConfig ¶
type BlobConfig struct {
ProjectURL string // Base project URL of the blob storage service
APIKey string // API key for authentication with the blob storage provider
Bucket string // Target bucket name for storing or retrieving objects
}
BlobConfig holds the configuration required to connect to a blob storage provider.
func LoadEnvBlobConfig ¶
func LoadEnvBlobConfig() (*BlobConfig, error)
LoadEnvBlobConfig reads the BlobConfig values from environment variables: BLOB_PROJECT_URL, BLOB_API_KEY, and BLOB_BUCKET.
func NewBlobConfig ¶
func NewBlobConfig(url, apiKey, bucket string) *BlobConfig
func (*BlobConfig) WithAPIKey ¶
func (cfg *BlobConfig) WithAPIKey(apiKey string) *BlobConfig
WithAPIKey sets the APIKey and returns the updated BlobConfig.
func (*BlobConfig) WithBucket ¶
func (cfg *BlobConfig) WithBucket(bucket string) *BlobConfig
WithBucket sets the Bucket and returns the updated BlobConfig.
func (*BlobConfig) WithProjectURL ¶
func (cfg *BlobConfig) WithProjectURL(url string) *BlobConfig
WithProjectURL sets the ProjectURL and returns the updated BlobConfig.
type DBConfig ¶
type DBConfig struct {
Driver string // Driver is used to set db engine (postgres, mysql and so on)
DSN string // DSN is used to connect to the database
PoolSize uint8 // Maximum number of open connections in the pool
MaxIdle uint8 // Maximum number of idle connections in the pool
MaxLifetime time.Duration // Maximum lifetime of a connection before it's recycled
}
DBConfig holds the configuration parameters for a database connection.
func LoadEnvDBConfig ¶
LoadEnvDBConfig loads the database configuration from environment variables. Required variables: DB_DSN, DB_POOL_SIZE, DB_MAX_IDLE, DB_MAX_LIFETIME.
func NewDBConfig ¶
func (*DBConfig) WithDriver ¶ added in v0.2.0
WithDriver sets the Driver string and returns the updated DBConfig.
func (*DBConfig) WithMaxLifetime ¶
WithMaxLifetime sets the MaxLifetime value and returns the updated DBConfig.
func (*DBConfig) WithPoolSize ¶
WithPoolSize sets the PoolSize and returns the updated DBConfig.
type JWTConfig ¶
type JWTConfig struct {
CookieName string // Name of the cookie that stores the JWT
Secret string // Secret key used to sign JWTs
TokenTTL time.Duration // Time-to-live duration of the token
}
JWTConfig holds the configuration related to JWT-based authentication.
func LoadEnvJWTConfig ¶
LoadEnvJWTConfig loads the JWT configuration from environment variables: JWT_COOKIE_NAME, JWT_SECRET, and JWT_TOKEN_TTL.
func (*JWTConfig) WithCookieName ¶
WithCookieName sets the cookie name for the JWTConfig.
func (*JWTConfig) WithSecret ¶
WithSecret sets the secret key for signing JWTs in the JWTConfig.
type KVConfig ¶
type KVConfig struct {
KVStoreURL string // URL of the key-value store
}
KVConfig holds configuration details for connecting to a key-value store.
func LoadEnvKVConfig ¶
LoadEnvKVConfig loads the key-value store configuration from the environment variable KV_STORE_URL.
func NewKVConfig ¶
func (*KVConfig) WithKVStoreURL ¶
WithKVStoreURL sets a new key-value store URL and returns the updated KVConfig.
type MailerConfig ¶
type MailerConfig struct {
Host string // SMTP server host
Port string // SMTP server port
Username string // SMTP username for authentication
Password string // SMTP password or token for authentication
From string // Default "From" email address
}
MailerConfig holds SMTP configuration for sending emails.
func LoadEnvMailerConfig ¶
func LoadEnvMailerConfig() (*MailerConfig, error)
LoadEnvMailerConfig loads MailerConfig values from environment variables: MAILER_HOST, MAILER_PORT, MAILER_USERNAME, MAILER_PASSWORD, MAILER_FROM.
func NewMailerConfig ¶
func NewMailerConfig(host, port, username, password, from string) *MailerConfig
func (*MailerConfig) WithFrom ¶
func (cfg *MailerConfig) WithFrom(from string) *MailerConfig
WithFrom sets the default "From" email address and returns the updated MailerConfig.
func (*MailerConfig) WithHost ¶
func (cfg *MailerConfig) WithHost(host string) *MailerConfig
WithHost sets the SMTP host and returns the updated MailerConfig.
func (*MailerConfig) WithPassword ¶
func (cfg *MailerConfig) WithPassword(password string) *MailerConfig
WithPassword sets the SMTP password and returns the updated MailerConfig.
func (*MailerConfig) WithPort ¶
func (cfg *MailerConfig) WithPort(port string) *MailerConfig
WithPort sets the SMTP port and returns the updated MailerConfig.
func (*MailerConfig) WithUsername ¶
func (cfg *MailerConfig) WithUsername(username string) *MailerConfig
WithUsername sets the SMTP username and returns the updated MailerConfig.
type OAuthConfig ¶
type OAuthConfig struct {
ClientID string // OAuth client ID
ClientSecret string // OAuth client secret
RedirectURL string // OAuth redirect URL after authentication
}
OAuthConfig holds OAuth 2.0 client credentials and redirect URL.
func LoadEnvOAuthConfig ¶
func LoadEnvOAuthConfig() (*OAuthConfig, error)
LoadEnvOAuthConfig loads OAuthConfig from environment variables: OAUTH_CLIENT_ID, OAUTH_CLIENT_SECRET, and OAUTH_REDIRECT_URL.
func NewOAuthConfig ¶
func NewOAuthConfig(clientID, clientSecret, redirectURL string) *OAuthConfig
func (*OAuthConfig) WithClientID ¶
func (cfg *OAuthConfig) WithClientID(clientID string) *OAuthConfig
WithClientID sets the OAuth client ID and returns the updated config.
func (*OAuthConfig) WithClientSecret ¶
func (cfg *OAuthConfig) WithClientSecret(clientSecret string) *OAuthConfig
WithClientSecret sets the OAuth client secret and returns the updated config.
func (*OAuthConfig) WithRedirectURL ¶
func (cfg *OAuthConfig) WithRedirectURL(redirectURL string) *OAuthConfig
WithRedirectURL sets the OAuth redirect URL and returns the updated config.
type PaymentConfig ¶
type PaymentConfig struct {
APIKey string // Public API key for the payment provider
SecretKey string // Secret key for authenticating requests
WebhookURL string // URL to receive payment provider webhook callbacks
WebhookSecret string // Secret used to verify webhook authenticity
}
PaymentConfig holds configuration details for payment processing.
func LoadEnvPaymentConfig ¶
func LoadEnvPaymentConfig() (*PaymentConfig, error)
LoadEnvPaymentConfig loads PaymentConfig from environment variables: PAYMENT_API_KEY, PAYMENT_SECRET_KEY, PAYMENT_WEBHOOK_URL, PAYMENT_WEBHOOK_SECRET.
func NewPaymentConfig ¶
func NewPaymentConfig(apiKey, secretKey, url, webhookSecret string) *PaymentConfig
func (*PaymentConfig) WithAPIKey ¶
func (cfg *PaymentConfig) WithAPIKey(key string) *PaymentConfig
WithAPIKey sets the API key and returns the updated config.
func (*PaymentConfig) WithSecretKey ¶
func (cfg *PaymentConfig) WithSecretKey(secret string) *PaymentConfig
WithSecretKey sets the secret key and returns the updated config.
func (*PaymentConfig) WithWebhookSecret ¶
func (cfg *PaymentConfig) WithWebhookSecret(secret string) *PaymentConfig
WithWebhookSecret sets the webhook secret and returns the updated config.
func (*PaymentConfig) WithWebhookURL ¶
func (cfg *PaymentConfig) WithWebhookURL(url string) *PaymentConfig
WithWebhookURL sets the webhook URL and returns the updated config.