configs

package
v0.0.0-...-8e21e68 Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2021 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DebugMode indicates mode is debug.
	DebugMode = "debug"
	// ReleaseMode indicates mode is release.
	ReleaseMode = "release"
	// TestMode indicates mode is test.
	TestMode = "test"
)
View Source
const EnvMode = EnvPrefix + "MODE"

EnvMode indicates environment name for mode

View Source
const EnvPrefix = "AUTH_"

EnvPrefix is prefix of environment variables to be used in the application.

Variables

This section is empty.

Functions

func Mode

func Mode() string

Mode returns currently mode.

func SetMode

func SetMode(value string)

SetMode sets mode according to input string.

func SetSMTPPort

func SetSMTPPort(port int)

SetSMTPPort configures the port of the smtp server used global in application.

Types

type AppConfig

type AppConfig struct {
	ListenPort               int
	SignupTokenExpire        int
	SessionTokenExpire       int
	ResetPasswordTokenExpire int
	JWTSigninKey             string
	Org                      string
	SupportEmail             string
	PageSize                 string
	PageSizeLimit            int
	// contains filtered or unexported fields
}

AppConfig contains the values needed to operate application.

func App

func App() *AppConfig

App returns the Values needed to operate application. Value not set in environment variable is set to fixed value.

func (*AppConfig) GracefulShutdownDuration

func (c *AppConfig) GracefulShutdownDuration() time.Duration

GracefulShutdownDuration is returns duration value to be used when GracefulShutdown.

func (*AppConfig) ResetPasswordURL

func (c *AppConfig) ResetPasswordURL(token string) string

ResetPasswordURL is returns reset password url to be used by frontend.

func (*AppConfig) SecretKeyLen

func (c *AppConfig) SecretKeyLen() int

SecretKeyLen is returns key length value required when creating a secretKey.

func (*AppConfig) SignupURL

func (c *AppConfig) SignupURL(token string) string

SignupURL is returns signup url to be used by frontend.

type DatabaseConfig

type DatabaseConfig struct {
	Echo       bool
	SyncModels bool
	// contains filtered or unexported fields
}

DatabaseConfig contains values for database access.

func DB

func DB() (*DatabaseConfig, error)

DB returns the values needed to access the database. If required value constraint is not met, an error is returned.

func (*DatabaseConfig) DBName

func (c *DatabaseConfig) DBName() string

DBName is returns database name to be used in the current application.

func (*DatabaseConfig) DSN

func (c *DatabaseConfig) DSN() string

DSN is returns database source name.

type EnvError

type EnvError struct {
	Func string
	Err  error
}

EnvError is an error type returned when a required environment variable is not set.

func (*EnvError) Error

func (e *EnvError) Error() string

type SMTPConfig

type SMTPConfig struct {
	// contains filtered or unexported fields
}

SMTPConfig contains values for smtp server.

func SMTP

func SMTP() *SMTPConfig

SMTP is returns values needed to connect smtp server.

func (*SMTPConfig) Addr

func (c *SMTPConfig) Addr() string

Addr is returns smtp server address.

func (*SMTPConfig) DialAndQuit

func (c *SMTPConfig) DialAndQuit() error

DialAndQuit is checks smtp server is running. If not running, an error is returned.

Jump to

Keyboard shortcuts

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