config

package
v0.0.0-...-fd201ba Latest Latest
Warning

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

Go to latest
Published: Aug 17, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AppDeviceHeaderKey     string = "x-AppDevice"
	AppVersionHeaderKey    string = "x-AppVersion"
	AuthorizationHeaderKey string = "Authorization"
)
View Source
const (
	AuthTokenUserUUID       string = "sub"
	AuthTokenJTI            string = "jti"
	AuthTokenIssuedAt       string = "iat"
	AuthTokenExpirationTime string = "exp"
)

please never change this keys

Variables

This section is empty.

Functions

func ResetConfig

func ResetConfig()

ResetConfig is a helper function to reset the config and once for testing purposes.

Types

type App

type App struct {
	Name               string
	Env                string
	Debug              bool
	Timezone           string
	Locale             string
	PathLocale         string
	GracefullyShutdown time.Duration
	ResetPasswordURL   string
	VerificationURL    string
	SupportEmail       string
}

type Auth

type Auth struct {
	Name          string
	Version       string
	URL           string
	Port          string
	Debug         bool
	EncryptionKey string
}

type Config

type Config struct {
	Kong           Kong
	App            App
	Auth           Auth
	UserManagement UserManagement
	Notification   Notification
	Profile        Profile
	Log            Log
	Swagger        Swagger
	DB             DB
	Redis          Redis
	Jwt            Jwt
	OTP            OTP
	TOTP           TOTP
	RabbitMQ       RabbitMQ
	SendGrid       SendGrid
	Oauth          Oauth
	Minio          Minio
	Password       Password
}

Config represents the application configuration.

func (*Config) GetConfig

func (r *Config) GetConfig(envPath ...string) Config

GetConfig loads the configuration once and returns it.

func (*Config) LoadConfig

func (r *Config) LoadConfig(envPath ...string) (Config, error)

LoadConfig loads configuration from .env file and populates the Config struct.

type Configuration

type Configuration interface {
	LoadConfig(envPath ...string) (Config, error)
	GetConfig(envPath ...string) Config
}

type DB

type DB struct {
	Connection string
	Host       string
	Port       string
	Name       string
	Username   string
	Password   string
	Postgres   DBPostgres
}

type DBPostgres

type DBPostgres struct {
	SSLMode            string
	MaxOpenConnections int
	MaxIdleConnections int
	MaxLifetime        time.Duration
	Timezone           string
}

type Google

type Google struct {
	ClientId     string
	ClientSecret string
	CallbackURL  string
}

type Jwt

type Jwt struct {
	AccessTokenSecret    string
	AccessTokenExpireDay time.Duration
}

type Kong

type Kong struct {
	APIBaseUrl      string
	SwaggerFilePath string
	AuthorizeUrl    string
}

type Log

type Log struct {
	FilePath   string
	Level      string
	MaxSize    int
	MaxAge     int
	MaxBackups int
}

type Minio

type Minio struct {
	Endpoint   string
	Port       string
	ID         string
	Secret     string
	BucketName string
}

type MockConfiguration

type MockConfiguration struct {
	mock.Mock
}

func (*MockConfiguration) GetConfig

func (r *MockConfiguration) GetConfig(envPath ...string) Config

func (*MockConfiguration) LoadConfig

func (r *MockConfiguration) LoadConfig(envPath ...string) (Config, error)

type Notification

type Notification struct {
	Name    string
	Version string
	URL     string
	Port    string
	Debug   bool
}

type OTP

type OTP struct {
	ExpireSecond               time.Duration
	ForgetPasswordExpireSecond time.Duration
	Digits                     int8
}

type Oauth

type Oauth struct {
	Google
}

type Password

type Password struct {
	BcryptCost int
}

type Profile

type Profile struct {
	Debug bool
	Port  string
}

type RabbitMQ

type RabbitMQ struct {
	URL string
}

type Redis

type Redis struct {
	Host               string
	Port               string
	Password           string
	DB                 int
	Prefix             string
	DialTimeout        time.Duration
	ReadTimeout        time.Duration
	WriteTimeout       time.Duration
	PoolSize           int
	PoolTimeout        time.Duration
	IdleTimeout        time.Duration
	IdleCheckFrequency time.Duration
}

type SendGrid

type SendGrid struct {
	Key     string
	Name    string
	Address string
}

type Swagger

type Swagger struct {
	Host     string
	Schemes  string
	Info     SwaggerInfo
	Enable   bool
	Username string
	Password string
}

type SwaggerInfo

type SwaggerInfo struct {
	Title       string
	Description string
	Version     string
}

type TOTP

type TOTP struct {
	ExpireSecond time.Duration
}

type UserManagement

type UserManagement struct {
	Name     string
	Version  string
	HTTPUrl  string
	GRPCUrl  string
	HTTPPort string
	GRPCPort string
	Debug    bool
}

Jump to

Keyboard shortcuts

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