Documentation ¶
Index ¶
- Constants
- Variables
- func GetDBConfig() storage.Config
- func GetJWTConfig() auth.Config
- func GetPlatformConfig() platforming.Config
- func GetPubSubConfig() queueing.MasterConfig
- func GetQueueConfig() queueing.Config
- func NewStaticConfig(f string) error
- func SaveConfigToYamlFile(f string, config StaticConfig) error
- func SetStaticConfig(config StaticConfig)
- type DynamicConfig
- type StaticConfig
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 GetDBConfig ¶
func GetJWTConfig ¶
func GetPlatformConfig ¶
func GetPlatformConfig() platforming.Config
func GetPubSubConfig ¶
func GetPubSubConfig() queueing.MasterConfig
func GetQueueConfig ¶
func NewStaticConfig ¶
func SaveConfigToYamlFile ¶
func SaveConfigToYamlFile(f string, config StaticConfig) error
func SetStaticConfig ¶ added in v0.3.0
func SetStaticConfig(config StaticConfig)
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" default:"60"` // Enables or disables competition globally Enabled *bool `json:"enabled,omitempty" default:"false" gorm:"not null;default:false"` }
DynamicConfig model is a set of columns describing the dynamicConfig of the scoring engine
func NewDynamicConfig ¶
func NewDynamicConfig(f string) (*DynamicConfig, error)
NewDynamicConfig initializes global config d, but it doesn't need any locking because it is assumed that NewDynamicConfig is ran once at the start of the application
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 `default:"2"` // How frequently to pull dynamic configs DynamicConfigPullSeconds uint `default:"5"` Queue queueing.Config Platform platforming.Config PubSubConfig queueing.MasterConfig AdminUsername string `default:"admin"` AdminPassword string `default:"changeme"` Port string `default:"33333"` Prod bool `default:"false"` CertFile string `default:""` KeyFile string `default:""` 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
Click to show internal directories.
Click to hide internal directories.