Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
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.
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 ¶
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.