config

package
v0.0.0-...-3bb7120 Latest Latest
Warning

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

Go to latest
Published: Aug 21, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ConfigEnvVar is the environment variable name for the config file path
	ConfigEnvVar = "CONFIG"

	// DefaultConfigPath is the default path for the config file
	DefaultConfigPath = "./config.yaml"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Server      ServerConfig      `mapstructure:"server"`
	Email       EmailConfig       `mapstructure:"email"`
	Database    DatabaseConfig    `mapstructure:"database"`
	Redis       RedisConfig       `mapstructure:"redis"`
	Session     SessionConfig     `mapstructure:"session"`
	Typesense   TypesenseConfig   `mapstructure:"typesense"`
	Stripe      StripeConfig      `mapstructure:"stripe"`
	GoogleOAuth GoogleOAuthConfig `mapstructure:"google_oauth"`
	Logger      LoggerConfig      `mapstructure:"logger"`
}

Config holds all configuration for the application

func New

func New() (*Config, error)

New creates and returns a new Config instance

type DatabaseConfig

type DatabaseConfig struct {
	Host     string
	Port     string
	User     string
	Password string
	Database string
	SSLMode  string
	PgDriver string
}

DatabaseConfig holds database-specific configuration

type EmailConfig

type EmailConfig struct {
	APIKey                         string
	FromEmail                      string
	Templates                      string
	SignupVerificationTemplateName string
}

EmailConfig holds email-specific configuration

type GoogleOAuthConfig

type GoogleOAuthConfig struct {
	ClientID     string
	ClientSecret string
	RedirectURL  string
	Scopes       []string
}

type LoggerConfig

type LoggerConfig struct {
	Level      string
	Format     string
	AddSource  bool
	TimeFormat string
}

type RedisConfig

type RedisConfig struct {
	Host         string
	Port         string
	Username     string
	Password     string
	DB           int
	MinIdleConns int
	MaxIdleConns int
}

RedisConfig holds Redis-specific configuration

type ServerConfig

type ServerConfig struct {
	Host    string
	Port    string
	IsHTTPS bool
}

ServerConfig holds server-specific configuration

type SessionConfig

type SessionConfig struct {
	CookieName    string
	AuthLifetime  time.Duration
	GuestLifetime time.Duration
}

type StripeConfig

type StripeConfig struct {
	SecretKey string
}

StripeConfig holds Stripe-specific configuration

type TypesenseConfig

type TypesenseConfig struct {
	Host     string
	Port     int
	APIKey   string
	UseHTTPS bool
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
JackTT - Gopher 🇻🇳