config

package
v0.31.10 Latest Latest
Warning

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

Go to latest
Published: Feb 12, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package config contains configurable default values for various aspects of goradd.

To change these values, set them from within an init() function in your application.

Index

Constants

View Source
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

View Source
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

View Source
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.

View Source
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.

View Source
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.

View Source
var CacheBusterPrefix = "gr."

CacheBusterPrefix is a fragment that is included with cache busted paths.

View Source
var DefaultDateEntryFormat = "1/2/06"
View Source
var DefaultDateFormat = "January 2, 2006"
View Source
var DefaultDateTimeEntryFormat = "1/2/06 3:04 pm"
View Source
var DefaultDateTimeFormat = "January 2, 2006 3:04 pm"
View Source
var DefaultFormFieldWrapperIdSuffix = "-ff"

DefaultFormFieldWrapperIdSuffix is the default suffix added to form control wrapper ids

View Source
var DefaultPage = "index.html"

DefaultPage is the default path of a url that ends with "/". Specify an empty string to have no default pages.

View Source
var DefaultTimeEntryFormat = "3:04 pm"
View Source
var DefaultTimeFormat = "3:04 pm"
View Source
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

View Source
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.

View Source
var Minify bool = !Debug

Minify controls whether we try to strip out unnecessary whitespace from our HTML output

View Source
var NoSelectionString = "-"

NoSelectionString is used in selection lists as the item that indicates no selection when a selection is not required

View Source
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.

View Source
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.

View Source
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.

View Source
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

View Source
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.

View Source
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 GoraddDir added in v0.0.9

func GoraddDir() string

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.

func (BlueMondaySanitizer) Sanitize

func (s BlueMondaySanitizer) Sanitize(in string) string

type DefaultSanitizer added in v0.31.10

type DefaultSanitizer struct {
}

func (DefaultSanitizer) Sanitize added in v0.31.10

func (s DefaultSanitizer) Sanitize(in string) string

type Sanitizer

type Sanitizer interface {
	Sanitize(string) string
}

Sanitizer describes an object that can sanitize user input

var GlobalSanitizer Sanitizer

GlobalSanitizer is used by control.Textbox controls to sanitize user input before it is stored

Jump to

Keyboard shortcuts

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