Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AWSConfig ¶
type AWSConfig struct {
Region string `json:"region"`
}
AWSConfig represents the configuration for AWS services
type Config ¶
type Config struct { Server ServerConfig `json:"server"` OAuth OAuthConfig `json:"oauth"` DB DBConfig `json:"db"` JWT JWTConfig `json:"jwt"` Logging LoggingConfig `json:"logging"` AWS AWSConfig `json:"aws"` Mail MailConfig `json:"mail"` }
Config represents the configuration for the application It includes settings for the server, database, JWT, logging, and AWS services.
func LoadConfig ¶
LoadConfig loads the application configuration from environment variables and default settings. It initializes configuration using a default set of values and overrides them with environment variables.
type DBConfig ¶
type DBConfig struct { Host string `json:"host"` Port string `json:"port"` User string `json:"user"` Password string `json:"password"` Name string `json:"name"` SSLMode string `json:"ssl_mode"` LogLevel int `json:"log_level"` Migrations bool `json:"migrations"` Pool struct { MaxOpen int `json:"max_open"` MaxIdle int `json:"max_idle"` MaxLifetime time.Duration `json:"max_lifetime"` } `json:"pool"` }
DBConfig represents the configuration for the database
type JWTConfig ¶
type JWTConfig struct { Secret string `json:"secret"` RefreshTokenExpiry time.Duration `json:"refresh_token_exp"` AccessTokenExpiry time.Duration `json:"access_token_exp"` }
JWTConfig represents the configuration for the JWT
type LoggingConfig ¶
LoggingConfig represents the configuration for logging
type MailConfig ¶
type MailConfig struct { SMTP struct { Server string `json:"server"` Port int `json:"port"` Username string `json:"username"` Password string `json:"password"` } `json:"smtp"` FromEmail string `json:"from_email"` Provider string `json:"provider"` }
MailConfig represents the email settings.
type OAuthConfig ¶
type OAuthConfig struct { Google ProviderConfig `json:"google"` Microsoft ProviderConfig `json:"microsoft"` }
OAuthConfig holds the configuration for multiple OAuth providers.
type ProviderConfig ¶
type ProviderConfig struct { ClientID string `json:"client_id"` ClientSecret string `json:"client_secret"` RedirectURL string `json:"redirect_url"` Scopes string `json:"scopes"` }
ProviderConfig represents the common OAuth settings required by each provider.
func (*ProviderConfig) GetScopes ¶
func (oauth *ProviderConfig) GetScopes() []string
GetScopes splits the Scopes string into a slice of individual scope strings. The Scopes field is expected to be a comma-separated string, and this method returns each scope as an element in a slice of strings.
type ServerConfig ¶
type ServerConfig struct { Port uint `json:"port"` Production bool `json:"production"` ReadTimeout time.Duration `json:"read_timeout"` WriteTimeout time.Duration `json:"write_timeout"` GracefulShutdown time.Duration `json:"graceful_shutdown"` Domain string `json:"domain"` }
ServerConfig represents the configuration for the server