appconfig

package
v0.0.0-...-3cf2f40 Latest Latest
Warning

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

Go to latest
Published: Dec 9, 2019 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Compat = false

true by default, for now.

Functions

This section is empty.

Types

type ConfigData

type ConfigData struct {
	MainSettings MainSettings
}

type ConnectionType

type ConnectionType int
const (
	Oauth  ConnectionType = 0
	Oauth2 ConnectionType = 1
	JWT    ConnectionType = 2
)

type DbSettings

type DbSettings struct {
	Providers []string
	Database  int `json:"database"`
	Data      struct {
		Address     string `json:"address"`
		Username    string `json:"username"`
		Password    string `json:"password"`
		DbName      string `json:"dbname"`
		TablePrefix string `json:"tableprefix"`
	} `json:"data"`
}

--- Maps dbconfig.yml fields to DbSettings fields -------------------------------------------------------------------

func (*DbSettings) GetDbConfig

func (d *DbSettings) GetDbConfig() *DbSettings

--- Gets called from Services and returns DbSettings to Dependency Injection container ------------------------------

type MainSettings

type MainSettings struct {
	System struct {
		Token           string `json:"token"`
		CommandPrefix   string `json:"commandprefix"`
		RequireEmail    string `json:"requireemail"`
		ConsoleLogLevel int    `json:"consoleloglevel"`
		FileLogLevel    int    `json:"fileloglevel"`
	} `json:"system"`
	Integrations struct {
		WordPress  string `json:"wordpress"`
		Connection string `json:"connection"`
		WebAddress string `json:"webaddress"`
	} `json:"integrations"`
	Discord struct {
		Guild    string            `json:"guild"`
		BotUsers []string          `json:"botusers"`
		Roles    map[string]string `json:"roles"`
	} `json:"discord"`
	Assets struct {
		AssetCodes       []string          `json:"assetcodes"`
		ReplaceDate      map[string]string `json:"replacedate"`
		AssetReplaced    map[string]string `json:"assetreplaced"`
		AssetReplacement map[string]string `json:"assetreplacement"`
		ApiKeys          map[string]string `json:"apikey"`
		Packages         map[string]string `json:"package"`
		Version          map[string]string `json:"version"`
	} `json:"assets"`
}

func (*MainSettings) GetConfig

func (m *MainSettings) GetConfig() *MainSettings

type WordPressSettings

type WordPressSettings struct {
	ConnectionType    int
	ConnectionDetails struct {
		SiteAddress  string `json:"site_address"`
		ClientId     string `json:"client_id"`
		ClientSecret string `json:"client_secret"`
		Redirect     string `json:"redirect"`
		AppName      string `json:"app_name"`
		AccessUrl    string `json:"access_url"`
		AuthorizeUrl string `json:"authorize_url"`
		GrantType    string `json:"grant_type"`
	}
	Assets map[string]string `json:"assets"`
}

type Yaml

type Yaml struct {
	// contains filtered or unexported fields
}

func New

func New() *Yaml

Creates and returns a YAML struct.

func Open

func Open(file string) (*Yaml, error)

Creates and returns a YAML struct, from a file.

func (*Yaml) Get

func (y *Yaml) Get(route ...interface{}) interface{}

Returns a YAML setting

func (*Yaml) Read

func (y *Yaml) Read(filename string) error

Loads a YAML file from disk.

func (*Yaml) Save

func (y *Yaml) Save() error

Writes changes to the currently opened YAML file.

func (*Yaml) Set

func (y *Yaml) Set(params ...interface{}) error

Sets a YAML setting

func (*Yaml) Write

func (y *Yaml) Write(filename string) error

Writes the current YAML struct to disk.

Jump to

Keyboard shortcuts

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