Documentation ¶
Index ¶
Constants ¶
const ( File = "file" Yaml = "yaml" Properties = "properties" Ini = "ini" Json = "json" Xml = "xml" )
The file parsing options that are available for a server configuration file.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ConfigurationFile ¶
type ConfigurationFile struct { FileName string `json:"file"` Parser ConfigurationParser `json:"parser"` Replace []ConfigurationFileReplacement `json:"replace"` // contains filtered or unexported fields }
Defines a configuration file for the server startup. These will be looped over and modified before the server finishes booting.
func (*ConfigurationFile) IterateOverJson ¶
func (f *ConfigurationFile) IterateOverJson(data []byte) (*gabs.Container, error)
Iterate over an unstructured JSON/YAML/etc. interface and set all of the required key/value pairs for the configuration file.
We need to support wildcard characters in key searches, this allows you to make modifications to multiple keys at once, especially useful for games with multiple configurations per-world (such as Spigot and Bungeecord) where we'll need to make adjustments to the bind address for the user.
This does not currently support nested matches. container.*.foo.*.bar will not work.
func (*ConfigurationFile) LookupConfigurationValue ¶
func (f *ConfigurationFile) LookupConfigurationValue(cfr ConfigurationFileReplacement) ([]byte, error)
Looks up a configuration value on the Daemon given a dot-notated syntax.
type ConfigurationFileReplacement ¶
type ConfigurationFileReplacement struct { Match string `json:"match"` IfValue string `json:"if_value"` ReplaceWith ReplaceValue `json:"replace_with"` }
Defines a single find/replace instance for a given server configuration file.
func (*ConfigurationFileReplacement) SetAtPathway ¶
func (cfr *ConfigurationFileReplacement) SetAtPathway(c *gabs.Container, path string, value []byte) error
Sets the value at a specific pathway, but checks if we were looking for a specific value or not before doing it.
func (*ConfigurationFileReplacement) UnmarshalJSON ¶
func (cfr *ConfigurationFileReplacement) UnmarshalJSON(data []byte) error
Handles unmarshaling the JSON representation into a struct that provides more useful data to this functionality.
type ConfigurationParser ¶
type ConfigurationParser string
type ReplaceValue ¶
type ReplaceValue struct {
// contains filtered or unexported fields
}
func (*ReplaceValue) String ¶
func (cv *ReplaceValue) String() string
func (*ReplaceValue) Type ¶
func (cv *ReplaceValue) Type() jsonparser.ValueType
func (*ReplaceValue) Value ¶
func (cv *ReplaceValue) Value() []byte