config

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Sep 5, 2024 License: AGPL-3.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CtxMiddlewareGenerator

func CtxMiddlewareGenerator(config *Config) (mw func(http.Handler) http.Handler)

Types

type ArgonConfig

type ArgonConfig struct {
	Time    int
	Memory  int
	Threads int
	Keylen  int
}

type Config

type Config struct {
	ArgonConfig ArgonConfig

	DBHost           string
	DBPort           string
	DBUser           string
	DBPassword       string
	DBSSLMode        string
	DBName           string
	DBMigrationsPath string
	DBConnUri        string
	DBConnDSN        string

	ListenAddr   string
	SecretKey    string
	NatsURL      string
	MailgunKey   string
	RedisURL     string
	DiscordToken string
	// Puzzles
	PuzzleGenerationSecretKey      string
	ECSClusterName                 string
	PuzzleGenerationTaskDefinition string

	TourneyPDFLambdaFunctionName string

	Debug bool
	// contains filtered or unexported fields
}

func Ctx

func Ctx(ctx context.Context) (*Config, error)

ctx gets the config from the context, or an error if no config is found.

func DefaultConfig

func DefaultConfig() *Config

func (*Config) Load

func (c *Config) Load(args []string) error

Load loads the configs from the given arguments

func (*Config) MacondoConfig

func (c *Config) MacondoConfig() *macondoconfig.Config

func (*Config) WGLConfig

func (c *Config) WGLConfig() *wglconfig.Config

func (*Config) WithContext

func (c *Config) WithContext(ctx context.Context) context.Context

WithContext stores the config in the passed-in context, returning a new context. Context.

type ConfigService

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

func NewConfigService

func NewConfigService(cs ConfigStore, userStore user.Store) *ConfigService

func (*ConfigService) GetUserDetails

func (*ConfigService) SetAnnouncements

func (*ConfigService) SetFEHash

func (*ConfigService) SetGamesEnabled

func (*ConfigService) SetSingleAnnouncement

func (*ConfigService) SetUserPermissions

type ConfigStore

type ConfigStore interface {
	SetGamesEnabled(context.Context, bool) error
	GamesEnabled(context.Context) (bool, error)

	SetFEHash(context.Context, string) error
	FEHash(context.Context) (string, error)

	SetAnnouncements(context.Context, []*pb.Announcement) error
	GetAnnouncements(context.Context) ([]*pb.Announcement, error)
	SetAnnouncement(context.Context, string, *pb.Announcement) error
}

Jump to

Keyboard shortcuts

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