config

package
v0.0.0-...-08c5b1d Latest Latest
Warning

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

Go to latest
Published: Sep 23, 2024 License: MIT Imports: 5 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
	Version     string
	Port        int
	Environment AppEnv
	LogPath     string
}

type AppEnv

type AppEnv string
const (
	ENV_PRODUCTION  AppEnv = "PROD"
	ENV_DEVELOPMENT AppEnv = "DEV"
)

type Config

type Config struct {
	App   AppConfig
	DB    DBConfig
	Cors  CorsConfig
	Token TokenConfig
}

func LoadConfig

func LoadConfig(path string) (*Config, error)

Load and Parse Config, pass the path of the config file relatively from the root dir

func (Config) IsProduction

func (c Config) IsProduction() bool

type CorsConfig

type CorsConfig struct {
	Origins     []string
	Credentials bool
}

type DBConfig

type DBConfig struct {
	Username        string
	Password        string
	Host            string
	Port            int
	Name            string
	MinConns        int // PG Pool minimum connections
	MaxConns        int // PG Pool maximum connections
	MaxConnLifetime int // PG Pool maximun connection lifetime, In Minute
}

type TokenConfig

type TokenConfig struct {
	SecretKey          string
	AccessTokenExpiry  time.Duration
	RefreshTokenExpiry time.Duration
}

Jump to

Keyboard shortcuts

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