config

package
v0.3.2 Latest Latest
Warning

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

Go to latest
Published: Oct 9, 2023 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// CryptoKeyLen defines the required length of cryptographic keys
	CryptoKeyLen = 32
)

Some crypto defaults

Variables

This section is empty.

Functions

This section is empty.

Types

type CfgOpt

type CfgOpt func(parm *ConfParm)

CfgOpt is a overloading function for the New() method

func WithConfFile

func WithConfFile(p string) CfgOpt

WithConfFile overrides the default config file path/name

type ConfParm

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

ConfParm sets some overridable parameters for the config file parsing

type Config

type Config struct {
	Discord struct {
		Token   string `fig:"token"`
		ShardID int    `fig:"shard_id" default:"0"`
	}
	DB struct {
		Host     string `fig:"host" validate:"required"`
		Username string `fig:"user" default:"arrgo"`
		Password string `fig:"pass"`
		Database string `fig:"db" default:"arrgo"`
		UseTLS   bool   `fig:"use_tls"`
		Port     int    `fig:"port" default:"5432"`
	}
	Log struct {
		Level string `fig:"level" default:"info"`
	}
	Data struct {
		EncryptionKey string `fig:"enc_key"`
	}
	Timer struct {
		FHSpam   int           `fig:"flameheart_spam" default:"60"`
		TRUpdate time.Duration `fig:"traderoutes_update" default:"12h"`
		USUpdate time.Duration `fig:"userstats_update" default:"6h"`
		URUpdate time.Duration `fig:"userrep_update" default:"24h"`
		RCCheck  time.Duration `fig:"ratcookie_check" default:"6h"`
		DDUpdate time.Duration `fig:"dailydeed_update" default:"24h"`
		ULUpdate time.Duration `fig:"userledger_update" default:"6h"`
	}
	// contains filtered or unexported fields
}

Config represents the global configuration struct that the config file is marshalled into

func New

func New(ol ...CfgOpt) (Config, error)

func (*Config) ConfFilePath

func (c *Config) ConfFilePath() string

ConfFilePath returns the internal path the config file for reference

func (*Config) GetFirstRun added in v0.1.7

func (c *Config) GetFirstRun() bool

GetFirstRun returns the state of the firstRun flag in the config

func (*Config) SetFirstRun added in v0.1.7

func (c *Config) SetFirstRun()

SetFirstRun sets the fristRun flag in the config to true

Jump to

Keyboard shortcuts

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