env

package
v0.5.1 Latest Latest
Warning

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

Go to latest
Published: Feb 11, 2023 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package env contains code for handling environment variables

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenerateRandomKey

func GenerateRandomKey(length int) []byte

GenerateRandomKey creates a random key with the given length in bytes. On failure, returns nil.

Note that keys created using `GenerateRandomKey()` are not automatically persisted. New keys will be created when the application is restarted, and previously issued cookies will not be able to be decoded.

Callers should explicitly check for the possibility of a nil return, treat it as a failure of the system random number generator, and not continue.

func GetBase64

func GetBase64(varName string) ([]byte, error)

func GetBool

func GetBool(varName string) (bool, error)

func GetFloat32

func GetFloat32(varName string, defaultValue float32) (float32, error)

func GetInt64

func GetInt64(varName string, defaultValue int64) (int64, error)

func GetKey

func GetKey(varName string, length int) ([]byte, error)

func GetString

func GetString(varName string, defaultValue string) string

func GetURL

func GetURL(varName string, defaultValue string) (*url.URL, error)

func GetURLOrigin

func GetURLOrigin(varName, defaultValue, defaultScheme string) (*url.URL, error)

func GetUint64

func GetUint64(varName string, defaultValue uint64) (uint64, error)

Types

This section is empty.

Jump to

Keyboard shortcuts

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