Documentation ¶
Index ¶
Constants ¶
const DefaultTokenSecret = "D8AB934ECD92D0008477DFFE679D06A89779DE4BDB0D436A0B1D16E4F5BEFA2B"
DefaultTokenSecret is the default key used when there is no env vars
Variables ¶
var DBHost = GetVar("DB_HOST", "localhost")
DBHost for the production/development database
var DBName = GetVar("DB_NAME", "pricewatch")
DBName for the production/development database
var DBPassword = GetVar("DB_PASSWORD", "postgres")
DBPassword for the production/development database
var DBPort = GetVar("DB_PORT", "5432")
DBPort for the production/development database
var DBUrl = GetVar("DATABASE_URL", "")
DBUrl is the database url string
var DBUser = GetVar("DB_USER", "postgres")
DBUser for the production/development database
var GPTokenSecret = []byte(GetVar("GP_TOKEN_SECRET", DefaultTokenSecret))
GPTokenSecret is the secret token for authorization through JWT
var ServerPort = GetVar("PORT", "8080")
ServerPort is the port the server listens on
var Sugar = logger.Sugar()
Sugar is an API for logging from Logger.
Functions ¶
func CheckError ¶
func CheckError(err error)
CheckError panics on an error, ending the program. It takes in the error to panic on if at all.
func ExtractClaims ¶
ExtractClaims will take the claim out of an authorization header. It takes in the JWT tokenString to read the claims from. It returns a map of string to interface for the claims.
func GenerateJWT ¶
GenerateJWT creates a JSON Web Token based on an id, with an expiration time of 1 day It returns the token string
func GetVar ¶
GetVar gets an environment variable with name name, and returns its value if its set If not, the function returns the default value
func HashPassword ¶
HashPassword hashes a password string
Types ¶
This section is empty.