config

package
v0.0.0-...-711557a Latest Latest
Warning

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

Go to latest
Published: Dec 31, 2024 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AppConfig

type AppConfig struct {
	Name        string
	Environment string
	LogLevel    string
}

type Config

type Config struct {
	App      AppConfig
	Database DatabaseConfig
	Server   ServerConfig
	JWT      JWTConfig
}

func LoadConfig

func LoadConfig() (*Config, error)

LoadConfig reads configuration from environment variables

type DatabaseConfig

type DatabaseConfig struct {
	Host     string
	Port     int
	User     string
	Password string
	DBName   string
	SSLMode  string
}

func (*DatabaseConfig) GetDSN

func (c *DatabaseConfig) GetDSN() string

GetDSN returns the database connection string

type JWTConfig

type JWTConfig struct {
	Secret          string
	ExpirationHours int
}

type ServerConfig

type ServerConfig struct {
	Host           string
	Port           int
	ReadTimeout    time.Duration
	WriteTimeout   time.Duration
	RequestTimeout time.Duration
	MaxHeaderBytes int
	AllowedOrigins []string
}

func (*ServerConfig) GetServerAddress

func (c *ServerConfig) GetServerAddress() string

GetServerAddress returns the formatted server address

Jump to

Keyboard shortcuts

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