Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Config ¶
type Config struct { Hostname string `mapstructure:"hostname"` ExternalIP string `mapstructure:"external_ip"` MaxConnections int `mapstructure:"max_connections"` LogFilePath string `mapstructure:"log_file_path"` LogLevel string `mapstructure:"log_level"` Web struct { HTTPPort int `mapstructure:"http_port"` } `mapstructure:"web"` Database struct { Engine string `mapstructure:"engine"` Host string `mapstructure:"host"` Port int `mapstructure:"port"` Name string `mapstructure:"name"` Username string `mapstructure:"username"` Password string `mapstructure:"password"` SSLMode string `mapstructure:"disable"` } `mapstructure:"database"` ShipgateServer struct { Port int `mapstructure:"port"` } `mapstructure:"shipgate_server"` PatchServer struct { PatchPort int `mapstructure:"patch_port"` DataPort int `mapstructure:"data_port"` PatchDir string `mapstructure:"patch_dir"` WelcomeMessage string `mapstructure:"welcome_message"` } `mapstructure:"patch_server"` LoginServer struct { Port int `mapstructure:"port"` } `mapstructure:"login_server"` CharacterServer struct { Port int `mapstructure:"port"` // TODO: Restore this config option when adding support for overriding these files. // ParametersDir string `mapstructure:"parameters_dir"` ScrollMessage string `mapstructure:"scroll_message"` } `mapstructure:"character_server"` ShipServer struct { Port int `mapstructure:"port"` Name string `mapstructure:"name"` NumBlocks int `mapstructure:"num_blocks"` } `mapstructure:"ship_server"` BlockServer struct { Port int `mapstructure:"port"` NumLobbies int `mapstructure:"num_lobbies"` } `mapstructure:"block_server"` Debugging struct { PprofEnabled bool `mapstructure:"pprof_enabled"` PprofPort int `mapstructure:"pprof_port"` PacketLoggingEnabled bool `mapstructure:"packet_logging_enabled"` DatabaseLoggingEnabled bool `mapstructure:"database_logging_enabled"` } `mapstructure:"debugging"` // contains filtered or unexported fields }
Config contains all of the configuration options available to any of Archon's server components. Descriptions are in config.yaml.
func LoadConfig ¶
LoadConfig initializes Viper with the contents of the config file under configPath.
func (*Config) BroadcastIP ¶
BroadcastIP converts the configured broadcast IP string into 4 bytes to be used with the redirect packet common to several servers.
func (*Config) DatabaseURL ¶
DatabaseURL returns a database URL generated from the provided config values.
func (*Config) ShipgateAddress ¶
ShipgateAddress returns the fully qualified address of the ship server. TODO: Since the current expectation is that the ship server is running alongside the other servers, this just uses the hostname. This should be fixed at some point to use an actual configurable address and the ship server given its own listen config.