Documentation ¶
Overview ¶
Package config is responsible for reading all environment variables and set up the base configuration for a functional application
Index ¶
- Constants
- func Config() (err error)
- func Env() error
- func InvalidateJWT() bool
- func Is2FA() bool
- func IsAuthCookie() bool
- func IsBasicAuth() bool
- func IsCORS() bool
- func IsEmailService() bool
- func IsEmailVerificationService() bool
- func IsHashPass() bool
- func IsJWT() bool
- func IsMongo() bool
- func IsPassRecoveryService() bool
- func IsRDBMS() bool
- func IsRedis() bool
- func IsSentry() bool
- func IsTemplatingEngine() bool
- func IsWAF() bool
- type Configuration
- type DatabaseConfig
- type EmailConfig
- type LoggerConfig
- type MongoDB
- type RDBMS
- type REDIS
- type SecurityConfig
- type ServerConfig
- type Status2FA
- type ViewConfig
Constants ¶
const Activated string = "yes"
Activated - "yes" keyword to activate a service
const PrefixJtiBlacklist string = "gorest-blacklist-jti:"
PrefixJtiBlacklist - to manage JWT blacklist in Redis database
Variables ¶
This section is empty.
Functions ¶
func InvalidateJWT ¶ added in v1.6.9
func InvalidateJWT() bool
InvalidateJWT returns true when this feature is enabled in .env
func Is2FA ¶ added in v1.6.9
func Is2FA() bool
Is2FA returns true when two-factor authentication is enabled in .env
func IsAuthCookie ¶ added in v1.6.9
func IsAuthCookie() bool
IsAuthCookie returns true when auth cookie is enabled in .env
func IsBasicAuth ¶ added in v1.6.9
func IsBasicAuth() bool
IsBasicAuth returns true when basic auth is enabled in .env
func IsEmailService ¶ added in v1.6.9
func IsEmailService() bool
IsEmailService returns true when email service is enabled in .env
func IsEmailVerificationService ¶ added in v1.6.9
func IsEmailVerificationService() bool
IsEmailVerificationService returns true when it is enabled in .env
func IsHashPass ¶ added in v1.6.9
func IsHashPass() bool
IsHashPass returns true when password hashing is enabled in .env
func IsMongo ¶ added in v1.6.9
func IsMongo() bool
IsMongo returns true when Mongo is enabled in .env
func IsPassRecoveryService ¶ added in v1.6.9
func IsPassRecoveryService() bool
IsPassRecoveryService returns true when it is enabled in .env
func IsRDBMS ¶ added in v1.6.9
func IsRDBMS() bool
IsRDBMS returns true when RDBMS is enabled in .env
func IsRedis ¶ added in v1.6.9
func IsRedis() bool
IsRedis returns true when Redis is enabled in .env
func IsSentry ¶ added in v1.6.9
func IsSentry() bool
IsSentry returns true when sentry logger is enabled in .env
func IsTemplatingEngine ¶ added in v1.6.9
func IsTemplatingEngine() bool
IsTemplatingEngine returns true when serving HTML is enabled in .env
Types ¶
type Configuration ¶
type Configuration struct { Database DatabaseConfig EmailConf EmailConfig Logger LoggerConfig Server ServerConfig Security SecurityConfig ViewConfig ViewConfig }
Configuration - server and db configuration variables
func GetConfig ¶ added in v1.6.1
func GetConfig() *Configuration
GetConfig - return all the config variables
type DatabaseConfig ¶
type DatabaseConfig struct { // relational database RDBMS RDBMS // redis database REDIS REDIS // mongo database MongoDB MongoDB }
DatabaseConfig - all database variables
type EmailConfig ¶ added in v1.6.1
type EmailConfig struct { Activate string Provider string APIToken string AddrFrom string TrackOpens bool TrackLinks string DeliveryType string // for templated email EmailVerificationTemplateID int64 PasswordRecoverTemplateID int64 EmailVerificationCodeLength uint64 PasswordRecoverCodeLength uint64 EmailVerificationTag string PasswordRecoverTag string HTMLModel string EmailVerifyValidityPeriod uint64 // in seconds PassRecoverValidityPeriod uint64 // in seconds }
EmailConfig - for external email services
type LoggerConfig ¶ added in v1.2.4
LoggerConfig ...
type MongoDB ¶ added in v1.4.3
type MongoDB struct { Activate string Env struct { AppName string URI string PoolSize uint64 PoolMon string ConnTTL int } }
MongoDB - mongo database variables
type RDBMS ¶ added in v1.4.3
type RDBMS struct { Activate string Env struct { Driver string Host string Port string TimeZone string } Access struct { DbName string User string Pass string } Ssl struct { Sslmode string MinTLS string RootCA string ServerCert string ClientCert string ClientKey string } Conn struct { MaxIdleConns int MaxOpenConns int ConnMaxLifetime time.Duration } Log struct { LogLevel int } }
RDBMS - relational database variables
type REDIS ¶ added in v1.4.3
type REDIS struct { Activate string Env struct { Host string Port string } Conn struct { PoolSize int ConnTTL int } }
REDIS - redis database variables
type SecurityConfig ¶ added in v1.3.0
type SecurityConfig struct { UserPassMinLength int MustBasicAuth string BasicAuth struct { Username string Password string } MustJWT string JWT middleware.JWTParameters InvalidateJWT string // when user logs off, invalidate the tokens AuthCookieActivate bool AuthCookiePath string AuthCookieDomain string AuthCookieSecure bool AuthCookieHTTPOnly bool AuthCookieSameSite http.SameSite ServeJwtAsResBody bool MustHash string HashPass lib.HashPassConfig VerifyEmail bool RecoverPass bool MustFW string Firewall struct { ListType string IP string } MustCORS string CORS []middleware.CORSPolicy TrustedPlatform string Must2FA string TwoFA struct { Issuer string Crypto crypto.Hash Digits int Status Status2FA PathQR string } }
SecurityConfig ...
type ServerConfig ¶
ServerConfig ...
type ViewConfig ¶ added in v1.5.0
ViewConfig - HTML renderer