Documentation ¶
Index ¶
- Constants
- Variables
- func AssetDirectory() string
- func GoraddAssets() string
- func GoraddDir() string
- func HtmlDirectory() string
- func MakeLocalPath(p string) string
- func ProjectAssets() string
- func ProjectDir() string
- func SetAssetDirectory(assetDir string)
- func SetHtmlDirectory(d string)
- func SetLocalPathMaker(f LocalPathMaker)
- func SetProjectDir(path string)
- type BlueMondaySanitizer
- type LocalPathMaker
- type Sanitizer
Constants ¶
const Debug = true
The Debug constant is used throughout the framework to turn on or off various debugging features. It is on by default. To turn it off, build with the -tags "nodebug" flag
const Release = false
The Release constant is used throughout the framework to determine if we are running the development version or release version of the product. The development version is designed to make on-going development easier, and the release version is designed to run on a deployment server. It is off by default, but you can turn it on by building with the -tags "release" flag. Combine with the nodebug tag like so: go build -tags "release nodebug" You might build a release version that keeps the debug features on if you are building for manual testers
Variables ¶
var ApiPrefix = ""
var AssetPrefix = "/assets/"
AssetPrefix is the path prefix for all goradd assets. It indicates to the program to look for the given file in the assets collection of files which in development mode is wherever the file is on the disk, and in release mode, the central asset directory where all assets get copied
var DefaultDateEntryFormat = "1/2/06"
var DefaultDateFormat = "January 2, 2006"
var DefaultDateTimeEntryFormat = "1/2/06 3:04am"
var DefaultDateTimeFormat = "January 2, 2006 3:04am"
var DefaultTimeEntryFormat = "3:04 am"
var DefaultTimeFormat = "3:04 am"
var HSTSTimeout int64 = 86400 // one day
HSTSTimeout sets the HSTS timeout length in seconds. See HSTSHandler in app_base.go for info Set this to -1 to turn off HSTS
var IdleTimeout = 180 * time.Second
IdleTimout is used during keep-alive connections to control how often the client must ping us to keep the connection alive. It helps us detect whether the client has gone away so that we can then close the connection.
var Minify bool = !Debug
Minify controls whether we try to strip out unnecessary whitespace from our HTML output
var NoSelectionString = "-"
NoSelectionString is used in selection lists as the item that indicates no selection when a selection is not required
var Port int = 8000
var ProxyPath string
AliasPath is the url path to the application. By default, this is the root, but you can set it to any path. This is particularly useful to making the application appear as if it is running in a subdirectory of the root path. This is great for putting behind an Apache server, and using ProxyPass and ProxyPassReverse to direct traffic from a particular path to the application. This gets stripped off incoming urls automatically by the server, but needs to be added to all links to resources on the server.
var ReadHeaderTimeout = 0 * time.Second
ReadTimeout specifies the time that a client has to complete sending us its headers. See go's http package, server.go for details. This can be used to control per request read timeouts. If zero, ReadTimeout is used.
var ReadTimeout = 5 * time.Second
ReadTimeout specifies the time that a client has to complete sending us its request. It helps prevent an attack where the client opens a connection and then sends us data really slowly. See go's http package, server.go for details.
var SelectOneString = "- Select One -"
SelectOneString is used in selection lists as the default item to indicate that a selection is required but has not yet been made
var TLSCertFile = ""
You will need to put in the path to your certfile and keyfile below. The default implementation only uses these for the release build.
var TLSKeyFile = ""
var TLSPort int = 0 // This will require ssl certificates. The default has this turned off.
var UseFCGI bool
var WebSocketPort int = 8100 // Default can be reset later, or via command line, but before the application starts. Set to zero to turn it off.
var WebSocketTLSCertFile = ""
You will need to put in the path to your certfile and keyfile below. The default implementation only uses these for the release build. You can use the same ones that you use for normal SSL communication over http.
var WebSocketTLSKeyFile = ""
var WebSocketTLSPort int = 0 // This will require ssl certificates. The default has this turned off.
var WriteTimeout = 10 * time.Second
WriteTimeout is the amount of time our server will wait for our app to finish writing the response. It helps prevent an attack where the server makes a request, but then reads the response very slowly.
Functions ¶
func AssetDirectory ¶
func AssetDirectory() string
func GoraddAssets ¶
func GoraddAssets() string
GoraddAssets returns the disk location of the assets directory.
func HtmlDirectory ¶
func HtmlDirectory() string
func MakeLocalPath ¶ added in v0.7.0
MakeLocalPath turns a path that points to a resource on this computer into a path that will reach that resource. It takes into account a variety of settings that may affect the path and that will depend on how the app is deployed. You can inject your own local path maker using SetLocalPathMaker
func ProjectAssets ¶
func ProjectAssets() string
func ProjectDir ¶
func ProjectDir() string
func SetAssetDirectory ¶
func SetAssetDirectory(assetDir string)
func SetHtmlDirectory ¶
func SetHtmlDirectory(d string)
func SetLocalPathMaker ¶ added in v0.7.0
func SetLocalPathMaker(f LocalPathMaker)
func SetProjectDir ¶
func SetProjectDir(path string)
Types ¶
type BlueMondaySanitizer ¶
type BlueMondaySanitizer struct {
// contains filtered or unexported fields
}
BlueMondaySanitizer is a sanitizer based on microcosm-cc/bluemonday. BlueMonday is designed to sanitize input coming from a WYSIWYG HTML editor, so it has the annoying extra step of escaping HTML entities. We wrap the BlueMonday sanitizer in this structure so that we can unescape html entities before sending them to the textbox. We will still get all the stripping of javascript that the sanitizer normally does. If you want a different global sanitizer, change it here. Or, override the Sanitize function in the textbox object.
This sanitizer is no longer used by default, because it removes too much valid text. For example, a<b is changed. So, you need to be careful to escape anything you are outputting to the browser instead.
func (BlueMondaySanitizer) Sanitize ¶
func (s BlueMondaySanitizer) Sanitize(in string) string