etc

package module
v0.0.0-...-fa7c36c Latest Latest
Warning

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

Go to latest
Published: Aug 8, 2021 License: MIT Imports: 32 Imported by: 11

README

go.astheno

loc license discord paypal goreportcard

A family of functions and utilities to assist in the boostrapping and operation of Astheno web server projects.

Installing

$ go get -u github.com/nektro/go.etc

License

MIT

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	AppID      string
	Version    = "vMASTER"
	MFS        = new(types.MultiplexFileSystem)
	Database   dbstorage.Database
	ConfigPath string
	JWTSecret  string
	Port       int
	Epoch      = internal.Epoch
	HtpErrCb   = func(r *http.Request, w http.ResponseWriter, good bool, status int, message string) {}
)

globals

Functions

func ConfigAssertKeysNonEmpty

func ConfigAssertKeysNonEmpty(config interface{}, keys ...string)

func DataRoot

func DataRoot() string

func FixBareVersion

func FixBareVersion()

FixBareVersion will convert a 'vMASTER' version string to a string similar to 'vMASTER-2020.02.12-6cae79d'. Always append go version.

func GetSession

func GetSession(r *http.Request) *sessions.Session

func Init

func Init(config interface{}, doneURL string, saveOA2Info oauth2.SaveInfoFunc)

Init sets up app-agnostic features

func InitConfig

func InitConfig(path string, template interface{})

func JWTDestroy

func JWTDestroy(w http.ResponseWriter)

JWTDestroy tells the ResponseWriter to delete the 'jwt' cookie

func JWTGetClaims

func JWTGetClaims(c *htp.Controller, r *http.Request) jwt.MapClaims

JWTGetClaims reads the 'jwt' cookie and returns claims within it, if they are valid

func JWTSet

func JWTSet(w http.ResponseWriter, sub string)

JWTSet sets a 'jwt' cookie on the provided ResponseWriter

func PgpEncrypt

func PgpEncrypt(c *htp.Controller, message string, keys ...string) string

func PgpPubKeyFingerprint

func PgpPubKeyFingerprint(c *htp.Controller, keyText string) string

func PreInit

func PreInit()

PreInit registers and parses application flags

func SetSessionName

func SetSessionName(name string)

func StartServer

func StartServer()

func WriteHandlebarsFile

func WriteHandlebarsFile(r *http.Request, w http.ResponseWriter, path string, context map[string]interface{})

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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