utils

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Aug 20, 2025 License: BSD-2-Clause Imports: 6 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

View Source
var PlatformServerFlagConstants = map[string]map[string]string{
	"Hostname": {
		"FlagName":    "hostname",
		"ShortFlag":   "n",
		"Description": "Hostname where Plank accepts connections",
	},
	"Port": {
		"FlagName":    "port",
		"ShortFlag":   "p",
		"Description": "Port where Plank is to be served",
	},
	"RootDir": {
		"FlagName":    "rootdir",
		"ShortFlag":   "r",
		"Description": "Root directory for the server (default: Current directory)",
	},
	"Cert": {
		"FlagName":    "cert",
		"Description": "X509 Certificate file for TLS",
	},
	"CertKey": {
		"FlagName":    "cert-key",
		"Description": "X509 Certificate private Key file for TLS",
	},
	"Static": {
		"FlagName":    "static",
		"ShortFlag":   "s",
		"Description": "Path(s) where static files will be served",
	},
	"SpaPath": {
		"FlagName":    "spa-path",
		"Description": "Path to serve Single Page Application (SPA) from. The URI is derived from the leaf directory. A different URI can be specified by providing it following a colon (e.g. --spa-path ./path/to/spa-app:my-spa",
	},
	"NoFabricBroker": {
		"FlagName":    "no-fabric-broker",
		"Description": "Disable Fabric (STOMP) broker",
	},
	"FabricEndpoint": {
		"FlagName":    "fabric-endpoint",
		"Description": "Fabric broker endpoint",
	},
	"TopicPrefix": {
		"FlagName":    "topic-prefix",
		"Description": "Topic prefix for Fabric broker",
	},
	"QueuePrefix": {
		"FlagName":    "query-prefix",
		"Description": "Queue prefix for Fabric broker",
	},
	"RequestPrefix": {
		"FlagName":    "request-prefix",
		"Description": "Application request prefix for Fabric broker",
	},
	"RequestQueuePrefix": {
		"FlagName":    "request-queue-prefix",
		"Description": "Application request queue prefix for Fabric broker",
	},
	"ConfigFile": {
		"FlagName":    "config-file",
		"Description": "Path to the server config JSON file",
	},
	"ShutdownTimeout": {
		"FlagName":    "shutdown-timeout",
		"Description": "Graceful server shutdown timeout in minutes",
	},
	"OutputLog": {
		"FlagName":    "output-log",
		"ShortFlag":   "l",
		"Description": "Platform log output. Possible values: stdout, stderr, null, or path to a file",
	},
	"AccessLog": {
		"FlagName":    "access-log",
		"ShortFlag":   "a",
		"Description": "HTTP server access log output. Possible values: stdout, stderr, null, or path to a file",
	},
	"ErrorLog": {
		"FlagName":    "error-log",
		"ShortFlag":   "e",
		"Description": "HTTP server error log output. Possible values: stdout, stderr, null, or path to a file",
	},
	"Debug": {
		"FlagName":    "debug",
		"ShortFlag":   "d",
		"Description": "Enable debug logging",
	},
	"NoBanner": {
		"FlagName":    "no-banner",
		"ShortFlag":   "b",
		"Description": "Do not print Plank banner at startup",
	},
	"RestBridgeTimeout": {
		"FlagName":    "rest-bridge-timeout",
		"Description": "Time in minutes before a REST endpoint for a service request to timeout",
	},
}

Functions

func ContainsString

func ContainsString(arr []string, str string) bool

func ConvertInterfaceToByteArray

func ConvertInterfaceToByteArray(mimeType string, i interface{}) (results []byte, err error)

ConvertInterfaceToByteArray converts the interface i into a byte array. Depending on the value of mimeType being of JSON type, either JSON Marshaller is used or the interface is just straight cast to a byte array.

func DeriveStaticURIFromPath

func DeriveStaticURIFromPath(input string) (string, string)

func GetCallerStackFrame

func GetCallerStackFrame() runtime.Frame

func GetCurrentStackFrame

func GetCurrentStackFrame() runtime.Frame

func GetGoRoutineID

func GetGoRoutineID() string

func IsAbsolutePath

func IsAbsolutePath(p string) bool

IsAbsolutePath returns if path is an absolute path in *nix and Windows file systems

func JoinBasePathIfRelativeRegularFilePath

func JoinBasePathIfRelativeRegularFilePath(base string, in string) (out string)

func SanitizeUrl

func SanitizeUrl(url string, suffixSlash bool) string

SanitizeUrl removes excess forward slashes as well as pad the end of the URL with / if suffixSlash is true

Types

This section is empty.

Jump to

Keyboard shortcuts

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