Documentation ¶
Index ¶
- func CloseStackDriverErrorClient(errorClient *errorreporting.Client)
- func CloseStackDriverLoggingClient(loggingClient *logging.Client)
- func GetEnvVar(envVarName string) (string, error)
- func GetPinExpiryDate() (*time.Time, error)
- func GetUserTokenFromContext(ctx context.Context) (string, error)
- func IsMSISDNValid(msisdn string) bool
- func LogStartupError(ctx context.Context, err error)
- func MustGetEnvVar(envVarName string) string
- func NormalizeMSISDN(msisdn string) (*string, error)
- func StackDriver(ctx context.Context) *errorreporting.Client
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CloseStackDriverErrorClient ¶
func CloseStackDriverErrorClient(errorClient *errorreporting.Client)
CloseStackDriverErrorClient closes a StackDriver error client and logs any arising error.
It was written to be defer()'d in servrer initialization code.
func CloseStackDriverLoggingClient ¶
CloseStackDriverLoggingClient closes a StackDriver logging client and logs any arising error.
It was written to be defer()'d in servrer initialization code.
func GetEnvVar ¶
GetEnvVar retrieves the environment variable with the supplied name and fails if it is not able to do so
func GetPinExpiryDate ¶
GetPinExpiryDate returns the expiry date for the given pin
func GetUserTokenFromContext ¶
GetUserTokenFromContext retrieves a Firebase *auth.Token from the supplied context
func IsMSISDNValid ¶
IsMSISDNValid uses regular expression to validate the a phone number
func LogStartupError ¶
LogStartupError is used to e.g log fatal startup errors. It logs, attempts to report the error to StackDriver then panics/crashes.
func MustGetEnvVar ¶
MustGetEnvVar returns the value of the environment variable with the indicated name or panics. It is intended to be used in the INTERNALS of the server when we can guarantee (through orderly coding) that the environment variable was set at server startup. Since the env is required, kill the app if the env is not set. In the event a variable is not super required, set a sensible default or don't call this method
func NormalizeMSISDN ¶
NormalizeMSISDN validates the input phone number. For valid phone numbers, it normalizes them to international format e.g +2547........
func StackDriver ¶
func StackDriver(ctx context.Context) *errorreporting.Client
StackDriver initializes StackDriver logging, error reporting, profiling etc
Types ¶
This section is empty.