config

package
v0.0.0-...-1ec5b87 Latest Latest
Warning

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

Go to latest
Published: Mar 14, 2024 License: AGPL-3.0 Imports: 7 Imported by: 0

Documentation

Overview

Package config implements a configuration for Wraith game engine and web server.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Debug bool
	App   struct {
		Data            string // path to data files
		Assets          string // path to public assets
		Root            string
		Templates       string // path to templates
		TimestampFormat string
	}
	Auth struct {
		Providers string // comma separated list of authentication providers
	}
	Cookies struct {
		HttpOnly bool
		Secure   bool
	}
	DB       DBConfig
	FileName string
	Home     string
	Server   struct {
		Scheme         string
		Host           string
		MaxHeaderBytes int
		Port           string
		Timeout        struct {
			Idle  time.Duration
			Read  time.Duration
			Write time.Duration
		}
		Key  string
		Salt string
	}
}

Config defines configuration information for the application.

func Default

func Default() (*Config, error)

Default returns a default configuration. These are the values without loading the environment, configuration file, or command line.

func (*Config) Load

func (cfg *Config) Load() error

Load updates the values in a Config in this order:

  1. It will load a configuration file if one is given on the command line via the `-config` flag. If provided, the file must contain a valid JSON object.
  2. Environment variables, using the prefix `GOBBS`
  3. Command line flags

type DBConfig

type DBConfig struct {
	Host   string
	Port   int
	Name   string
	User   string
	Secret string
}

DBConfig holds mysql configuration.

func (DBConfig) DSN

func (db DBConfig) DSN() string

DSN returns a connect string for a mysql database.

Jump to

Keyboard shortcuts

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