config

package
v0.4.3 Latest Latest
Warning

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

Go to latest
Published: Jun 29, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AuthConfig added in v0.3.2

type AuthConfig struct {
	// for creating access and refresh tokens
	Secret string `mapstructure:"AUTH_TOKEN_SECRET"`
	// access token time to live
	AccessTokenExpDur time.Duration `mapstructure:"AUTH_ACCESS_TOKEN_EXPIRE_DURATION"`
	// refresh token time to live
	RefreshTokenExpDur time.Duration `mapstructure:"AUTH_REFRESH_TOKEN_EXPIRE_DURATION"`

	// verification token time to live
	VerifyTokenExpDur time.Duration `mapstructure:"AUTH_VERIFY_TOKEN_EXPIRE_DURATION"`
	// verification token request cooldown before new request
	VerifyTokenCooldown time.Duration `mapstructure:"AUTH_VERIFY_TOKEN_COOLDOWN"`

	// reset token time to live
	ResetTokenExpDur time.Duration `mapstructure:"AUTH_RESET_TOKEN_EXPIRE_DURATION"`
	// reset token request cooldown tiem before new request
	ResetTokenCooldown time.Duration `mapstructure:"AUTH_RESET_TOKEN_COOLDOWN"`

	// account deletion token time to live
	DeleteTokenExpDur time.Duration `mapstructure:"AUTH_DELETE_TOKEN_EXPIRE_DURATION"`
	// account deletion token request cooldown before new request
	DeleteTokenCooldown time.Duration `mapstructure:"AUTH_DELETE_TOKEN_COOLDOWN"`
}

type Config

type Config struct {
	// StartTime is the timestamp when the application started.
	StartTime time.Time

	// ServiceName is the name of the service
	ServiceName string `mapstructure:"SERVICE_NAME"`

	// ServerName is the name of the server, could be the hostname, or container's hostname.
	ServerName string `mapstructure:"SERVER_NAME"`

	// Host is the hostname for the REST server.
	Host string `mapstructure:"HOST"`

	// Port is the port number for the REST server.
	Port int `mapstructure:"PORT"`

	// RestPort is the port number for the REST server.
	RestPort int `mapstructure:"REST_PORT"`

	// gRPC Port is the port number for the gRPC server.
	GrpcPort int `mapstructure:"GRPC_PORT"`

	MaxRequestTimeout time.Duration `mapstructure:"MAX_REQUEST_TIMEOUT"`

	Database db.Config
	Mail     mail.Config
	Logger   logger.Config
	Auth     AuthConfig
}

Config represents the application configuration.

func LoadConfigs

func LoadConfigs(path string, name string, startTime time.Time) (config Config, err error)

LoadConfigs loads the configuration from the specified YAML file.

Jump to

Keyboard shortcuts

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