func (c *Info) FlashWarning(message string) {
	c.Sess.AddFlash(flash.Info{message, flash.Warning})
	c.Sess.Save(c.R, c.W)
}
FlashWarning saves a warning flash.
package flight
import (
	"fmt"
	"log"
	"net/http"
	"sync"
	"github.com/blue-jay/blueprint/lib/env"
	"github.com/blue-jay/core/flash"
	"github.com/blue-jay/core/form"
	"github.com/blue-jay/core/router"
	"github.com/blue-jay/core/view"
	"github.com/gorilla/sessions"
	"github.com/jmoiron/sqlx"
)
var (
	configInfo env.Info
	dbInfo     *sqlx.DB
	mutex sync.RWMutex
)
func StoreConfig(ci env.Info) {
	mutex.Lock()
	configInfo = ci
	mutex.Unlock()
}
func StoreDB(db *sqlx.DB) {
	mutex.Lock()
	dbInfo = db
	mutex.Unlock()
}
type Info struct {
	Config env.Info
	Sess   *sessions.Session
	UserID string
	W      http.ResponseWriter
	R      *http.Request
	View   view.Info
	DB     *sqlx.DB
}
func Context(w http.ResponseWriter, r *http.Request) Info {
	var id string
	sess, err := configInfo.Session.Instance(r)
	if err == nil {
		id = fmt.Sprintf("%v", sess.Values["id"])
	}
	mutex.RLock()
	i := Info{
		Config: configInfo,
		Sess:   sess,
		UserID: id,
		W:      w,
		R:      r,
		View:   configInfo.View,
		DB:     dbInfo,
	}
	mutex.RUnlock()
	return i
}
func Reset() {
	mutex.Lock()
	configInfo = env.Info{}
	dbInfo = &sqlx.DB{}
	mutex.Unlock()
}
func (c *Info) Param(name string) string {
	return router.Param(c.R, name)
}
func (c *Info) Redirect(urlStr string) {
	http.Redirect(c.W, c.R, urlStr, http.StatusFound)
}
func (c *Info) FormValid(fields ...string) bool {
	if valid, missingField := form.Required(c.R, fields...); !valid {
		c.Sess.AddFlash(flash.Info{"Field missing: " + missingField, flash.Warning})
		c.Sess.Save(c.R, c.W)
		return false
	}
	return true
}
func (c *Info) Repopulate(v map[string]interface{}, fields ...string) {
	form.Repopulate(c.R.Form, v, fields...)
}
func (c *Info) FlashSuccess(message string) {
	c.Sess.AddFlash(flash.Info{message, flash.Success})
	c.Sess.Save(c.R, c.W)
}
func (c *Info) FlashNotice(message string) {
	c.Sess.AddFlash(flash.Info{message, flash.Notice})
	c.Sess.Save(c.R, c.W)
}