Documentation ¶
Index ¶
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 AjaxTimeout = 10000
AjaxTimeout is the amount of time in milliseconds that we direct the browser to wait until it determines that an ajax call timed out. This would mean that the browser has lost the connection to the server. The goradd.js file put up a dialog on the screen telling the user to refresh the page to re-establish the connection. This only happens in release mode so that you don't have to worry about timeouts when debugging ajax code.
var ApiPrefix = "/api"
ApiPrefix is the url prefix that indicates this is an API call, like a REST or GraphQL call. Override this in your goradd_project/config package to change it.
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. set to blank to turn off the default asset management.
var CacheBusterPrefix = "gr."
CacheBusterPrefix is a fragment that is included with cache busted paths.
var DefaultDateEntryFormat = "1/2/06"
var DefaultDateFormat = "January 2, 2006"
var DefaultDateTimeEntryFormat = "1/2/06 3:04 pm"
var DefaultDateTimeFormat = "January 2, 2006 3:04 pm"
var DefaultPage = "index.html"
DefaultPage is the default path of a url that ends with "/". Specify an empty string to have no default pages.
var DefaultTimeEntryFormat = "3:04 pm"
var DefaultTimeFormat = "3:04 pm"
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
IdleTimeout 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 ProxyPath string
ProxyPath 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, and to cookies.
var ReadHeaderTimeout = 0 * time.Second
ReadHeaderTimeout 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 = 20 * 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 WebsocketMessengerPrefix = "/ws/"
WebsocketMessengerPrefix is the url prefix that indicates this is a Websocket call to our messenger service.
The default turns on Websockets and uses this to implement the Watcher and Messenger mechanisms. Override this in the goradd_project/config/goradd.go file to set to the value of your choice, or set to blank to turn off handling of websockets.
var WriteTimeout = 20 * 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 ProjectDir ¶
func ProjectDir() string
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