parser

package
v1.0.0-alpha.1 Latest Latest
Warning

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

Go to latest
Published: Dec 23, 2019 License: MIT Imports: 18 Imported by: 1

Documentation

Index

Constants

View Source
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, jsonparser.ValueType, error)

Looks up a configuration value on the Daemon given a dot-notated syntax.

func (*ConfigurationFile) Parse

func (f *ConfigurationFile) Parse(path string, internal bool) error

Parses a given configuration file and updates all of the values within as defined in the API response from the Panel.

type ConfigurationFileReplacement

type ConfigurationFileReplacement struct {
	Match     string               `json:"match"`
	Value     string               `json:"value"`
	ValueType jsonparser.ValueType `json:"-"`
}

Defines a single find/replace instance for a given server configuration file.

func (*ConfigurationFileReplacement) UnmarshalJSON

func (cfr *ConfigurationFileReplacement) UnmarshalJSON(data []byte) error

type ConfigurationParser

type ConfigurationParser string

Jump to

Keyboard shortcuts

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