config

package
v0.8.7 Latest Latest
Warning

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

Go to latest
Published: Oct 12, 2023 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Module = fx.Module("config",
	fx.Provide(
		Load,
	),
)

Functions

This section is empty.

Types

type Cache added in v0.7.0

type Cache struct {
	RefreshTime time.Duration `default:"2m" yaml:"refreshTime"`
}

type Config

type Config struct {
	LogLevel string `default:"DEBUG" yaml:"logLevel"`
	Mode     string `default:"debug" yaml:"mode"`

	Sentry  Sentry  `yaml:"sentry"`
	Tracing Tracing `yaml:"tracing"`

	HTTP     HTTP     `yaml:"http"`
	GRPC     GRPC     `yaml:"grpc"`
	Database Database `yaml:"database"`
	NATS     NATS     `yaml:"nats"`
	JWT      JWT      `yaml:"jwt"`
	OAuth2   OAuth2   `yaml:"oauth2"`
	Cache    Cache    `yaml:"cache"`

	Game    Game    `yaml:"game"`
	Discord Discord `yaml:"discord"`
}

func Load added in v0.8.0

func Load() (*Config, error)

func LoadTest added in v0.8.0

func LoadTest() (*Config, error)

type Database

type Database struct {
	// refer to https://github.com/go-sql-driver/mysql#dsn-data-source-name for details
	DSN string `yaml:"dsn"`

	// Connection options
	MaxOpenConns    int           `default:"32" yaml:"maxOpenConns"`
	MaxIdleConns    int           `default:"5" yaml:"maxIdleConns"`
	ConnMaxIdleTime time.Duration `default:"15m" yaml:"connMaxIdleTime"`
	ConnMaxLifetime time.Duration `default:"60m" yaml:"connMaxLifetime"`
}

type Discord added in v0.8.0

type Discord struct {
	Bot DiscordBot `yaml:"bot"`
}

type DiscordBot added in v0.8.0

type DiscordBot struct {
	Enabled      bool                `default:"false" yaml:"enabled"`
	SyncInterval time.Duration       `default:"15m" yaml:"syncInterval"`
	InviteURL    string              `yaml:"inviteURL"`
	Token        string              `yaml:"token"`
	UserInfoSync DiscordUserInfoSync `yaml:"userInfoSync"`
	GroupSync    DiscordGroupSync    `yaml:"groupSync"`
	Commands     DiscordCommands     `yaml:"commands"`
}

type DiscordCommands added in v0.8.5

type DiscordCommands struct {
	Enabled bool `default:"false" yaml:"enabled"`
}

type DiscordGroupRole added in v0.8.4

type DiscordGroupRole struct {
	RoleName    string `yaml:"roleName"`
	Permissions *int64 `yaml:"omitempty,permissions"`
}

type DiscordGroupSync added in v0.8.4

type DiscordGroupSync struct {
	Enabled bool                        `default:"false" yaml:"enabled"`
	Mapping map[string]DiscordGroupRole `yaml:"omitempty,mapping"`
}

type DiscordUserInfoSync added in v0.8.4

type DiscordUserInfoSync struct {
	Enabled       bool   `default:"false" yaml:"enabled"`
	RoleFormat    string `default:"[%02d] %s" yaml:"roleFormat"`
	NicknameRegex string `yaml:"nicknameRegex"`
}

type DispatchCenter added in v0.8.1

type DispatchCenter struct {
	ConvertJobs []string `yaml:"convertJobs"`
}

type GRPC

type GRPC struct {
	Listen string `default:":9090" yaml:"listen"`
}

type Game

type Game struct {
	SignupEnabled      bool           `default:"true" yaml:"signupEnabled"`
	AuditRetentionDays *int           `default:"90" yaml:"auditRetentionDays"`
	SuperuserGroups    []string       `yaml:"superuserGroups"`
	UnemployedJob      UnemployedJob  `yaml:"unemployedJob"`
	PublicJobs         []string       `yaml:"publicJobs"`
	Livemap            Livemap        `yaml:"livemap"`
	DispatchCenter     DispatchCenter `yaml:"dispatchCenter"`
	DefaultPermissions []Perm         `yaml:"defaultPermissions"`
}

type HTTP

type HTTP struct {
	Listen    string   `default:":8080" yaml:"listen"`
	Sessions  Sessions `yaml:"sessions"`
	PublicURL string   `yaml:"publicURL"`
}

type JWT

type JWT struct {
	Secret string `yaml:"secret"`
}

type Livemap added in v0.5.0

type Livemap struct {
	RefreshTime time.Duration `default:"3s350ms" yaml:"refreshTime"`
	Jobs        []string      `yaml:"jobs"`
	PostalsFile string        `default:".output/public/data/postals.json" yaml:"postalsFile"`
}

type NATS added in v0.5.1

type NATS struct {
	URL         string `default:"nats://localhost:4222" yaml:"url"`
	WorkerCount int    `default:"5" yaml:"workerCount"`
}

type OAuth2

type OAuth2 struct {
	Providers []*OAuth2Provider
}

type OAuth2Endpoints

type OAuth2Endpoints struct {
	AuthURL     string `yaml:"authURL"`
	TokenURL    string `yaml:"tokenURL"`
	UserInfoURL string `yaml:"userInfoURL"`
}

type OAuth2Mapping

type OAuth2Mapping struct {
	ID       string `yaml:"id"`
	Username string `yaml:"username"`
	Avatar   string `yaml:"avatar"`
}

type OAuth2Provider

type OAuth2Provider struct {
	Name          string             `yaml:"name"`
	Label         string             `yaml:"label"`
	Homepage      string             `yaml:"homepage"`
	Type          OAuth2ProviderType `yaml:"type"`
	DefaultAvatar string             `yaml:"defaultAvatar"`
	RedirectURL   string             `yaml:"redirectURL"`
	ClientID      string             `yaml:"clientID"`
	ClientSecret  string             `yaml:"clientSecret"`
	Scopes        []string           `yaml:"scopes"`
	Endpoints     OAuth2Endpoints    `yaml:"endpoints"`
	Mapping       *OAuth2Mapping     `yaml:"omitempty,mapping"`
}

type OAuth2ProviderType

type OAuth2ProviderType string
const (
	OAuth2ProviderGeneric OAuth2ProviderType = "generic"
	OAuth2ProviderDiscord OAuth2ProviderType = "discord"
)

type Perm

type Perm struct {
	Category string `yaml:"category"`
	Name     string `yaml:"name"`
}

type Result added in v0.8.0

type Result struct {
	fx.Out

	Config *Config
}

type Sentry

type Sentry struct {
	ServerDSN   string `yaml:"serverDSN"`
	Environment string `default:"dev" yaml:"environment"`
	ClientDSN   string `default:"" yaml:"clientDSN"`
}

type Sessions

type Sessions struct {
	CookieSecret string `yaml:"cookieSecret"`
	Domain       string `default:"localhost" yaml:"domain"`
}

type Tracing

type Tracing struct {
	Enabled     bool   `default:"false" yaml:"enabled"`
	URL         string `yaml:"url"`
	Environment string `default:"dev" yaml:"environment"`
}

type UnemployedJob

type UnemployedJob struct {
	Name  string `default:"unemployed" yaml:"job"`
	Grade int32  `default:"1" yaml:"grade"`
}

Jump to

Keyboard shortcuts

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