app

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Sep 17, 2020 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var AppKey string

AppKey secret key value for JWT

Functions

func AuthMiddleware

func AuthMiddleware(next http.Handler) http.Handler

AuthMiddleware is middleware to check token is valid. Returning a 401 status to the client if it is not valid.

func InitDB

func InitDB(c *Conf) *sql.DB

InitDB setup database for use

func InitializeRoutes

func InitializeRoutes(env *Env)

InitializeRoutes setup route mappings

Types

type Conf

type Conf struct {
	SQLConf `yaml:"mysql-config"`
	JWTConf `yaml:"jwt-config"`
}

Conf contains yaml values

func GetConf

func GetConf() *Conf

GetConf setup database for use

type Env

type Env struct {
	DB                *sql.DB
	Tpl               *template.Template
	Router            *mux.Router
	DbSessionsCleaned time.Time
	Conf              *Conf
}

Env contains data required to start

type JWTConf

type JWTConf struct {
	Secret string `yaml:"secret"`
}

JWTConf contains config for jwt

type SQLConf

type SQLConf struct {
	Name     string `yaml:"name"`
	Usename  string `yaml:"username"`
	Password string `yaml:"password"`
	Port     string `yaml:"port"`
	Host     string `yaml:"host"`
}

SQLConf contains config for initializing the mysql db

Jump to

Keyboard shortcuts

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