config

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Oct 29, 2024 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var LogFlags = []cli.Flag{
	&cli.StringFlag{
		Name:    loLevel,
		Value:   "DEBUG",
		Usage:   "Application log level. Options: PANIC, FATAL, ERROR, WARNING, INFO, DEBUG, TRACE",
		EnvVars: []string{"LOG_LEVEL"},
	},
	&cli.BoolFlag{
		Name:    logJSON,
		Value:   false,
		Usage:   "Enable JSON format for logs. Defaults to false.",
		EnvVars: []string{"LOG_JSON"},
	},
}

LogFlags defines CLI flags for configuring the logging behavior. This includes flags for setting the log level and enabling JSON log formatting.

View Source
var SlotFlags = []cli.Flag{
	&cli.Float64Flag{
		Name:    multiplierThree,
		Value:   10,
		Usage:   "Multiplier for three matching symbols",
		EnvVars: []string{"MULTIPLIER_THREE"},
	},
	&cli.Float64Flag{
		Name:    multiplierTwo,
		Value:   2,
		Usage:   "Multiplier for two matching symbols",
		EnvVars: []string{"MULTIPLIER_TWO"},
	},
	&cli.Float64Flag{
		Name:    twoMatchProbability,
		Value:   0.30,
		Usage:   "Probability for winning with two matching symbols",
		EnvVars: []string{"TWO_MATCH_PROBABILITY"},
	},
	&cli.Float64Flag{
		Name:    threeMatchProbability,
		Value:   0.05,
		Usage:   "Probability for winning with three matching symbols",
		EnvVars: []string{"THREE_MATCH_PROBABILITY"},
	},
	&cli.StringFlag{
		Name:    rateLIMIT,
		Value:   "1-S",
		Usage:   "Rate limit for requests per second( 5 reqs/second: \"5-S\", 10 reqs/minute: \"10-M\", 100 reqs/hour: \"100-H\")",
		EnvVars: []string{"RATE_LIMIT"},
	},
}

SlotFlags defines the command-line flags for configuring the slot game, including multipliers and probabilities for different win conditions. Each flag is linked to an environment variable, allowing for configuration via the environment as well as the CLI.

Functions

func GetLogConfig

func GetLogConfig(c *cli.Context) *log.Config

GetLogConfig returns a configuration for logging based on CLI flags or environment variables. This includes the log level and whether logs should be formatted as JSON.

Types

type SlotConfig

type SlotConfig struct {
	MultiplierThree       float64 // Multiplier applied when three symbols match
	MultiplierTwo         float64 // Multiplier applied when two symbols match
	TwoMatchProbability   float64 // Probability for winning with two matching symbols
	ThreeMatchProbability float64 // Probability for winning with three matching symbols
	RateLimit             string  // Rate limit for requests per second
}

SlotConfig defines configuration parameters for the slot game, including multipliers and probabilities for different winning scenarios.

func GetSlotConfig

func GetSlotConfig(c *cli.Context) *SlotConfig

GetSlotConfig returns a SlotConfig instance populated from CLI context flags. This function extracts values for each configuration parameter from the provided cli.Context, allowing dynamic configuration through command-line flags.

Parameters:

  • c: The CLI context from which to retrieve flag values.

Returns:

A pointer to a SlotConfig struct with values obtained from the CLI flags.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
JackTT - Gopher 🇻🇳