config

package
v0.3.9 Latest Latest
Warning

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

Go to latest
Published: Sep 17, 2024 License: GPL-3.0 Imports: 9 Imported by: 5

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetAdminEmailFromEnvOrPanic added in v0.3.4

func GetAdminEmailFromEnvOrPanic(defaultAdminEmail string) string

GetAdminEmailFromEnvOrPanic returns the admin user to be used with JWT authentication from the content of the env variable : ADMIN_EMAIL : string containing the username to use for the administrative account

func GetAdminExternalIdFromEnvOrPanic added in v0.3.4

func GetAdminExternalIdFromEnvOrPanic(defaultAdminExternalId int) int

GetAdminExternalIdFromEnvOrPanic returns the admin user id to be used with JWT authentication from the content of the env variable ADMIN_EXTERNAL_ID : string containing the external user id to use for the administrative account

func GetAdminIdFromEnvOrPanic added in v0.3.4

func GetAdminIdFromEnvOrPanic(defaultAdminId int) int

GetAdminIdFromEnvOrPanic returns the admin user id to be used with JWT authentication from the content of the env variable ADMIN_ID : string containing the user id to use for the administrative account

func GetAdminPasswordFromEnvOrPanic added in v0.3.4

func GetAdminPasswordFromEnvOrPanic() string

GetAdminPasswordFromEnvOrPanic returns the admin password to be used with JWT authentication from the content of the env variable :

ADMIN_PASSWORD : string containing the password to use for the administrative account

func GetAdminUserFromEnvOrPanic added in v0.3.4

func GetAdminUserFromEnvOrPanic(defaultAdminUser string) string

GetAdminUserFromEnvOrPanic returns the admin user to be used with JWT authentication from the content of the env variable : ADMIN_USER : string containing the username to use for the administrative account

func GetAllowedHostsFromEnvOrPanic added in v0.3.0

func GetAllowedHostsFromEnvOrPanic() []string

GetAllowedHostsFromEnvOrPanic returns a list of valid TCP/IP addresses based on the values of env variable ALLOWED_HOSTS

ALLOWED_HOSTS : comma separated list of valid IP addresses
in case the ENV variable ALLOWED_HOSTS exists and contains invalid Host addresses the functions panics

func GetAllowedIpsFromEnvOrPanic added in v0.3.0

func GetAllowedIpsFromEnvOrPanic(defaultAllowedIps []string) []string

GetAllowedIpsFromEnvOrPanic returns a list of valid TCP/IP addresses based on the values of env variable ALLOWED_IP

ALLOWED_IP : comma separated list of valid IP addresses
 in case the ENV variable ALLOWED_IP exists and contains invalid IP addresses the functions panics
if the ENV variable ALLOWED_IP does not exist the function returns the defaultAllowedIps or panic if invalid

func GetJwtContextKeyFromEnvOrPanic added in v0.3.5

func GetJwtContextKeyFromEnvOrPanic() string

GetJwtContextKeyFromEnvOrPanic returns a secret to be used with JWT based on the content of the env variable JWT_CONTEXT_KEY : should exist and contain a string with your secret or this function will panic

func GetJwtDurationFromEnvOrPanic added in v0.3.0

func GetJwtDurationFromEnvOrPanic(defaultJwtDuration int) int

GetJwtDurationFromEnvOrPanic returns a number string based on the values of environment variable : JWT_DURATION_MINUTES : int value between 1 and 1440 minutes, 24H or 1 day is the maximum duration the parameter defaultJwtDuration will be used if this env variable is not defined in case the ENV variable JWT_DURATION_MINUTES exists and contains an invalid integer the functions ends execution with Fatalreturns 0 and an error

func GetJwtIssuerFromEnvOrPanic added in v0.3.0

func GetJwtIssuerFromEnvOrPanic() string

GetJwtIssuerFromEnvOrPanic returns a secret to be used with JWT based on the content of the env variable JWT_ISSUER_ID : should exist and contain a string with your secret or this function will panic

func GetJwtSecretFromEnvOrPanic added in v0.3.0

func GetJwtSecretFromEnvOrPanic() string

GetJwtSecretFromEnvOrPanic returns a secret to be used with JWT based on the content of the env variable JWT_SECRET : should exist and contain a string with your secret or this function will panic

func GetListenIpFromEnvOrPanic added in v0.3.0

func GetListenIpFromEnvOrPanic(defaultSrvIp string) string

GetListenIpFromEnvOrPanic returns a valid TCP/IP listening address based on the values of environment variable :

SRV_IP : int value between 1 and 65535 (the parameter defaultPort will be used if env is not defined)
 in case the ENV variable PORT exists and contains an invalid integer the functions panics

func GetPgDbDsnUrlFromEnvOrPanic added in v0.3.0

func GetPgDbDsnUrlFromEnvOrPanic(defaultIP string, defaultPort int,
	defaultDbName string, defaultDbUser string, defaultSSL string) string

GetPgDbDsnUrlFromEnvOrPanic returns a valid DSN connection string based on the values of environment variables :

	DB_HOST : string containing a valid Ip Address to use for DB connection
	DB_PORT : int value between 1 and 65535
	DB_NAME : string containing the database name
	DB_USER : string containing the database username
	DB_PASSWORD : string containing the database user password
 DB_SSL_MODE : string containing ssl mode (disable|allow|prefer|require|verify-ca|verify-full)
 more info on libpg SSL : https://www.postgresql.org/docs/11/libpq-ssl.html#LIBPQ-SSL-PROTECTION
 more info : https://pkg.go.dev/github.com/jackc/pgconn#ParseConfig

func GetPortFromEnvOrPanic added in v0.3.0

func GetPortFromEnvOrPanic(defaultPort int) int

GetPortFromEnvOrPanic returns a valid TCP/IP listening port based on the values of environment variable :

PORT : int value between 1 and 65535 (the parameter defaultPort will be used if env is not defined)
 in case the ENV variable PORT exists and contains an invalid integer the functions panics

func VerifyPasswordComplexity added in v0.3.0

func VerifyPasswordComplexity(s string) bool

VerifyPasswordComplexity checks if the password meets the minimum requirements of complexity At least one lowercase letter,one uppercase letter, one digit and one special character No white space, #, or | or ' character in it

Types

This section is empty.

Jump to

Keyboard shortcuts

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