Documentation ¶
Index ¶
- func GetAdminPasswordFromFromEnv() (string, error)
- func GetAdminUserFromFromEnv(defaultAdminUser string) string
- func GetJwtDurationFromEnv(defaultJwtDuration int) (int, error)
- func GetJwtSecretFromEnv() (string, error)
- func GetPgDbDsnUrlFromEnv(defaultIP string, defaultPort int, defaultDbName string, defaultDbUser string, ...) (string, error)
- func GetPortFromEnv(defaultPort int) (string, error)
- type Error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetAdminPasswordFromFromEnv ¶
GetAdminPasswordFromFromEnv returns the DB driver based on the value of environment variables :
ADMIN_PASSWORD : string containing the password to use for the administrative account
func GetAdminUserFromFromEnv ¶
GetAdminUserFromFromEnv returns the DB driver based on the value of environment variables :
ADMIN_USER : string containing the username to use for the administrative account
func GetJwtDurationFromEnv ¶
GetJwtDurationFromEnv returns a number string based on the values of environment variable : JWT_DURATION_MINUTES : int value between 1 and 14400 minutes, 10 days seems an extreme max value 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 returns 0 and an error
func GetJwtSecretFromEnv ¶
GetJwtSecretFromEnv returns a secret to be used with JWT based on the content of the env variable JWT_SECRET : should contain a string with your secret
func GetPgDbDsnUrlFromEnv ¶
func GetPgDbDsnUrlFromEnv(defaultIP string, defaultPort int, defaultDbName string, defaultDbUser string, defaultSSL string) (string, error)
GetPgDbDsnUrlFromEnv 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 GetPortFromEnv ¶
GetPortFromEnv returns a valid TCP/IP listening ':PORT' string 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 returns an empty string and an error