config

package
v0.0.0-...-5107381 Latest Latest
Warning

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

Go to latest
Published: Mar 8, 2022 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package config describes configuration for all of the core server, including adapters

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Adapters

type Adapters struct {
	// Hook provides the configuration for the Hook adapter.
	Hook HookConfig `toml:"hook"`

	// Test is for testing purposes only. Do not use.
	Test struct{}
}

Adapters stores configuration structs for adapters

func (Adapters) IsEnabled

func (a Adapters) IsEnabled(adapterName string) bool

IsEnabled returns whether or not the provided adapter name is enabled

type Config

type Config struct {
	// APIPort provides the port on which the core API is served.
	APIPort uint16 `toml:"api_port" validate:"nonempty"`

	// DataPath provides the path to the folder with raw EXD files (in CSV format)
	// containing game data.
	DataPath string `toml:"data_path" validate:"directory"`

	// AdminOTP provides a one time password that the admin can use to create an
	// admin token for the API.
	AdminOTP string `toml:"admin_otp" validate:"nonempty"`

	// DisableAuth allows starting the API server without requiring an auth
	// token for queries. CORS validation will still be enforced.
	DisableAuth bool `toml:"disable_auth"`

	// AllowOrigins allows the listed sites to bypass CORS validation without
	// having to register them. Note that scheme and subdomain must be provided.
	// Example: allow_sites = ["https://plugins.foo.com"]
	AllowOrigins []string `toml:"allow_origins"`

	// Maps provides the configuration for the Map endpoint of the API.
	Maps MapConfig `toml:"maps"`

	// Adapters contains the configuration for all the adapters enabled for
	// the core API.
	Adapters Adapters `toml:"adapters"`
}

Config stores configuration values for the Aetherometer core

func (*Config) Validate

func (c *Config) Validate() error

Validate returns an error when the provided configuration values do not pass validation

type Duration

type Duration time.Duration

func (*Duration) UnmarshalText

func (d *Duration) UnmarshalText(text []byte) error

type HookConfig

type HookConfig struct {
	// Enabled toggles whether or not the Hook adapter is enabled.
	Enabled bool `toml:"enabled"`

	// DLLPath sets the path of the Hook DLL on the system.
	DLLPath string `toml:"dll_path" validate:"file"`

	// FFXIVProcess is the name of the exe file for the game.
	FFXIVProcess string `toml:"ffxiv_process" validate:"nonempty"`

	// DialRetryInterval controls how long to wait before retrying
	// failures to make a connection with the hook DLL.
	// Defaults to 500 milliseconds.
	DialRetryInterval Duration `toml:"dial_retry_interval"`

	// PingInterval controls the interval between liveness checks to
	// hook. Defaults to 1 second.
	PingInterval Duration `toml:"ping_interval"`
}

HookConfig stores the configuration for the hook adapter

type MapConfig

type MapConfig struct {
	// Cache provides the path of the maps on the local disk.
	Cache string `toml:"cache" validate:"directory"`

	// APIPath provides the URL of an xivapi environment serving the maps if the
	// map could not be found on the local disk. Defaults to https://xivapi.com.
	APIPath string `toml:"api_path"`
}

Maps sets the configuration for the Map endpoint of the API.

type SourceDirs

type SourceDirs struct {
	MapsDir string `toml:"maps_dir" validate:"directory"`
}

SourceDirs is a table of directories that provide data used to interpret indexes sent over the network

Jump to

Keyboard shortcuts

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