config

package
v0.0.0-...-bc94fc3 Latest Latest
Warning

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

Go to latest
Published: May 16, 2024 License: AGPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var StringToLevel = map[string]logger.LogLevel{
	"trace": logger.LevelTrace,
	"debug": logger.LevelDebug,
	"info":  logger.LevelInfo,
	"warn":  logger.LevelWarning,
	"error": logger.LevelError,
	"fatal": logger.LevelFatal,
}

Functions

func ExecDir

func ExecDir() (string, error)

Returns the absolute path to the executable's directory, if it doesn't fail.

Types

type CharList

type CharList struct {
	Name       string   `toml:"name"`
	Characters []string `toml:"characters"`
}

type Character

type Character string

Right now we are using strings for songs and characters, but they could be more complicated structures with more metadata later.

type Characters

type Characters struct {
	Lists []CharList `toml:"list"`
}

func ReadCharacters

func ReadCharacters() (*Characters, error)

Attempts to read character settings. Returns nil CharList and an error if it fails.

type Music

type Music struct {
	Categories []SongCategory `toml:"category"`
}

func ReadMusic

func ReadMusic() (*Music, error)

Attempts to read music settings. Returns the nil Music and an error if it fails.

type Role

type Role struct {
	Name        string   `toml:"name"`
	Permissions []string `toml:"permissions"`
}

type Roles

type Roles struct {
	Confs []Role `toml:"role"`
}

func ReadRoles

func ReadRoles() (*Roles, error)

type Room

type Room struct {
	Name            string `toml:"name"`
	DefaultDesc     string `toml:"description"`
	DefaultBg       string `toml:"background"`
	LockBg          bool   `toml:"lock_background"`
	DefaultAmbiance string `toml:"ambiance"`
	LockAmbiance    bool   `toml:"lock_ambiance"`

	AdjacentRooms  []string `toml:"adjacent_rooms"`
	CharLists      []string `toml:"character_lists"`
	SongCategories []string `toml:"song_categories"`
	Sides          []string `toml:"side_list"`

	AllowBlankpost bool `toml:"allow_blankpost"`
	AllowShouting  bool `toml:"allow_shouting"`
	AllowIniswap   bool `toml:"allow_iniswap"`
	ForceImmediate bool `toml:"force_immediate"`

	// TODO: add buffered logging
	LogMethods []string `toml:"log_methods"`
	DebugLog   bool     `toml:"log_debug"`
}

func RoomDefault

func RoomDefault() *Room

type RoomList

type RoomList struct {
	Confs []Room `toml:"room"`
}

func ReadRooms

func ReadRooms() (*RoomList, error)

Attempts to read room settings. Returns nil RoomList and an error if it fails.

type Server

type Server struct {
	Name       string `toml:"name"`
	Username   string `toml:"server_username"`
	Desc       string `toml:"description"`
	MaxPlayers int    `toml:"max_players"`
	PortWS     int    `toml:"ws_port"`
	PortTCP    int    `toml:"legacy_port"`
	PortRPC    int    `toml:"rpc_port"`
	AllowAO    bool   `toml:"allow_ao"`
	AssetURL   string `toml:"asset_url"`

	// these seem more appropriate for a different section?
	MaxMsgSize  int `toml:"max_msg_size"`
	MaxNameSize int `toml:"max_name_size"`

	LevelString string `toml:"log_level"`
}

func ReadServer

func ReadServer() (*Server, error)

Attempts to read server configuration. Returns default server settings if it fails.

func ServerDefault

func ServerDefault() *Server

type Song

type Song string //TODO: song aliases

Right now we are using strings for songs and characters, but they could be more complicated structures with more metadata later.

type SongCategory

type SongCategory struct {
	Name  string `toml:"name"`
	Songs []Song `toml:"songs"`
}

Jump to

Keyboard shortcuts

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