config

package
v0.3.0-alpha5 Latest Latest
Warning

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

Go to latest
Published: Nov 22, 2021 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MinRoundDuration = time.Duration(20) * time.Second
)

Variables

View Source
var ErrRoundDurationLargerThanMinRoundDuration = errors.New("round Duration should not be larger than MinRoundDuration")

Functions

func NewStaticConfig

func NewStaticConfig(f string) error

func SaveConfigToYamlFile

func SaveConfigToYamlFile(f string, config StaticConfig) error

Types

type DynamicConfig

type DynamicConfig struct {
	ID uint64 `json:"id,omitempty"`
	// Describes how long each round unit takes to execute in seconds. This value shuold have a minimum value enforced (something like 20 seconds)
	RoundDuration uint64 `json:"round_duration,omitempty"`
	// Enables or disables competition globally
	Enabled *bool `json:"enabled,omitempty" gorm:"not null;default:false"`
}

DynamicConfig model is a set of columns describing the dynamicConfig of the scoring engine

func (*DynamicConfig) BeforeSave

func (d *DynamicConfig) BeforeSave(tx *gorm.DB) (err error)

func (*DynamicConfig) IsEqual

func (d *DynamicConfig) IsEqual(dc *DynamicConfig) bool

func (DynamicConfig) TableName

func (d DynamicConfig) TableName() string

type StaticConfig

type StaticConfig struct {
	DB storage.Config
	// This value ideally shouldn't be larger than few seconds
	DatabaseMaxTimeDriftSeconds uint
	// How frequently to pull dynamic configs
	DynamicConfigPullSeconds uint

	Queue queueing.Config

	Platform platforming.Config

	PubSubConfig queueing.MasterConfig

	AdminUsername string

	AdminPassword string

	Port string

	Prod bool

	CertFile string

	KeyFile string

	JWT auth.Config
}

StaticConfig is a struct of settings that are set at the start of the application. It contains Configs from other packages defined under pkg/ directory. StaticConfig is read only at the moment, hence there is no lock / prevention to race conditions.

func GetConfigCopy

func GetConfigCopy() (StaticConfig, error)

func GetStaticConfig

func GetStaticConfig() StaticConfig

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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