Documentation
¶
Index ¶
- Variables
- type Audit
- type Auth
- type Cache
- type Config
- type CustomDB
- type Database
- type Discord
- type DiscordCommands
- type DiscordGroupRole
- type DiscordGroupSync
- type DiscordPresence
- type DiscordUserInfoSync
- type DispatchCenter
- type FilesystemStorage
- type Game
- type HTTP
- type ImageProxy
- type ImageProxyOptions
- type JWT
- type Links
- type NATS
- type OAuth2
- type OAuth2Endpoints
- type OAuth2Mapping
- type OAuth2Provider
- type OAuth2ProviderType
- type Result
- type S3Storage
- type Sessions
- type Storage
- type StorageType
- type Sync
- type Tracing
- type TracingExporter
Constants ¶
This section is empty.
Variables ¶
View Source
var TestModule = fx.Module("config_test", fx.Provide(LoadTestConfig), )
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
LogLevel string `default:"DEBUG" yaml:"logLevel"`
Mode string `default:"debug" yaml:"mode"`
Tracing Tracing `yaml:"tracing"`
HTTP HTTP `yaml:"http"`
Database Database `yaml:"database"`
NATS NATS `yaml:"nats"`
JWT JWT `yaml:"jwt"`
Storage Storage `yaml:"storage"`
ImageProxy ImageProxy `yaml:"imageProxy"`
Audit Audit `yaml:"audit"`
OAuth2 OAuth2 `yaml:"oauth2"`
PostalsFile string `default:".output/public/data/postals.json" yaml:"postalsFile"`
Auth Auth `yaml:"auth"`
DispatchCenter DispatchCenter `yaml:"dispatchCenter"`
Discord Discord `yaml:"discord"`
Game Game `yaml:"game"`
Sync Sync `yaml:"sync"`
}
func LoadTestConfig ¶
type CustomDB ¶
type CustomDB struct {
Columns dbutils.CustomColumns `yaml:"columns"`
Conditions dbutils.CustomConditions `yaml:"conditions"`
}
type Database ¶
type Database struct {
// Refer to https://github.com/go-sql-driver/mysql#dsn-data-source-name for details
DSN string `yaml:"dsn"`
Net string `default:"tcp" yaml:"net"`
Host string `yaml:"host"`
Port int32 `default:"3306" yaml:"port"`
Username string `yaml:"username"`
Password string `yaml:"password"`
Database string `yaml:"database"`
Collation string `default:"utf8mb4_unicode_ci" yaml:"collation"`
// 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"`
ESXCompat bool `default:"false" yaml:"esxCompat"`
Custom CustomDB `yaml:"custom"`
}
type Discord ¶
type Discord struct {
Enabled bool `default:"false" yaml:"enabled"`
DryRun bool `default:"false" yaml:"dryRun"`
Token string `yaml:"token"`
UserInfoSync DiscordUserInfoSync `yaml:"userInfoSync"`
GroupSync DiscordGroupSync `yaml:"groupSync"`
Commands DiscordCommands `yaml:"commands"`
}
type DiscordCommands ¶
type DiscordCommands struct {
Enabled bool `default:"false" yaml:"enabled"`
}
type DiscordGroupRole ¶
type DiscordGroupSync ¶
type DiscordGroupSync struct {
Enabled bool `default:"false" yaml:"enabled"`
Mapping map[string]DiscordGroupRole `yaml:"omitempty,mapping"`
}
type DiscordPresence ¶
type DiscordUserInfoSync ¶
type DiscordUserInfoSync struct {
Enabled bool `default:"false" yaml:"enabled"`
GradeRoleFormat string `default:"[%grade%] %grade_label%" yaml:"gradeRoleFormat"`
EmployeeRoleFormat string `default:"%s Personal" yaml:"employeeRoleFormat"`
UnemployedRoleName string `default:"Citizen" yaml:"unemployedRoleName"`
JobsAbsceneRoleName string `default:"Absent" yaml:"jobsAbsceneRoleName"`
}
type DispatchCenter ¶
type DispatchCenter struct {
ConvertJobs []string `yaml:"convertJobs"`
}
type FilesystemStorage ¶
type FilesystemStorage struct {
Path string `yaml:"path"`
}
type Game ¶ added in v0.9.4
type Game struct {
StartJobGrade int32 `default:"0" yaml:"startJobGrade"`
}
type HTTP ¶
type HTTP struct {
Listen string `default:":8080" yaml:"listen"`
AdminListen string `default:":7070" yaml:"adminListen"`
Sessions Sessions `yaml:"sessions"`
Links Links `yaml:"links"`
PublicURL string `yaml:"publicURL"`
Origins []string `default:"" yaml:"origins"`
TrustedProxies []string `yaml:"trustedProxies"`
}
type ImageProxy ¶
type ImageProxy struct {
Enabled bool `default:"true" yaml:"enabled"`
URL string `default:"/api/image_proxy/" yaml:"url"`
CachePrefix string `default:"images/" yaml:"cachePrefix"`
Options ImageProxyOptions `yaml:"options"`
}
type ImageProxyOptions ¶
type OAuth2 ¶
type OAuth2 struct {
Providers []*OAuth2Provider
}
type OAuth2Endpoints ¶
type OAuth2Mapping ¶
type OAuth2Provider ¶
type OAuth2Provider struct {
Name string `yaml:"name"`
Label string `yaml:"label"`
Homepage string `yaml:"homepage"`
Type OAuth2ProviderType `yaml:"type"`
Icon *string `yaml:"icon"`
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 S3Storage ¶
type S3Storage struct {
Endpoint string `yaml:"endpoint"`
Region string `default:"us-east-1" yaml:"region"`
AccessKeyID string `yaml:"accessKeyID"`
SecretAccessKey string `yaml:"secretAccessKey"`
UseSSL bool `default:"true" yaml:"useSSL"`
BucketName string `yaml:"bucketName"`
Prefix string `yaml:"prefix"`
Retries int `default:"10" yaml:"retries"`
UsePreSigned bool `default:"true" yaml:"usePresigned"`
}
type Storage ¶
type Storage struct {
Type StorageType `default:"filesystem" yaml:"type"`
Filesystem FilesystemStorage `yaml:"filesystem"`
S3 S3Storage `yaml:"s3"`
}
type StorageType ¶ added in v0.9.5
type StorageType string
const ( StorageTypeS3 StorageType = "s3" StorageTypeFilesystem StorageType = "filesystem" StorageTypeNoop StorageType = "noop" )
type Tracing ¶
type Tracing struct {
Enabled bool `default:"false" yaml:"enabled"`
Type TracingExporter `default:"stdout" yaml:"type"`
URL string `yaml:"url"`
Insecure bool `yaml:"insecure"`
Timeout time.Duration `default:"10s" yaml:"timeout"`
Environment string `default:"dev" yaml:"environment"`
Ratio float64 `default:"0.1" yaml:"ratio"`
Attributes []string `yaml:"attributes"`
}
type TracingExporter ¶
type TracingExporter string
const ( TracingExporter_StdoutTrace TracingExporter = "stdout" TracingExporter_OTLPTraceGRPC TracingExporter = "otlptracegrpc" TracingExporter_OTLPTraceHTTP TracingExporter = "otlptracehttp" )
Click to show internal directories.
Click to hide internal directories.