Documentation ¶
Index ¶
- func InitCORS(cfg *CORSConfig) cors.Config
- func InitDB(cfg *DBConfig) (*gorm.DB, *sql.DB, error)
- func InitLog(env string, cfg *LogConfig) error
- func InitTracerProvider(cfg *Config) (*sdktrace.TracerProvider, error)
- type AppConfig
- type AuthConfig
- type CORSConfig
- type Config
- type DBConfig
- type DebugConfig
- type JaegerConfig
- type LogConfig
- type MySQLConfig
- type SQLite3Config
- type ShutdownConfig
- type SwaggerConfig
- type SynthesizerConfig
- type TatoebaConfig
- type TraceConfog
- type TranslatorConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func InitCORS ¶
func InitCORS(cfg *CORSConfig) cors.Config
func InitTracerProvider ¶
func InitTracerProvider(cfg *Config) (*sdktrace.TracerProvider, error)
Types ¶
type AppConfig ¶
type AppConfig struct { Name string `yaml:"name" validate:"required"` HTTPPort int `yaml:"httpPort" validate:"required"` MetricsPort int `yaml:"metricsPort" validate:"required"` OwnerPassword string `yaml:"ownerPassword" validate:"required"` TestUserEmail string `yaml:"testUserEmail" validate:"required"` }
type AuthConfig ¶
type AuthConfig struct { SigningKey string `yaml:"signingKey"` AccessTokenTTLMin int `yaml:"accessTokenTtlMin" validate:"gte=1"` RefreshTokenTTLHour int `yaml:"refreshTokenTtlHour" validate:"gte=1"` GoogleCallbackURL string `yaml:"googleCallbackUrl" validate:"required"` GoogleClientID string `yaml:"googleClientId" validate:"required"` GoogleClientSecret string `yaml:"googleClientSecret" validate:"required"` APITimeoutSec int `yaml:"apiTimeoutSec" validate:"gte=1"` }
type CORSConfig ¶
type CORSConfig struct {
AllowOrigins []string `yaml:"allowOrigins"`
}
type Config ¶
type Config struct { App *AppConfig `yaml:"app" validate:"required"` DB *DBConfig `yaml:"db" validate:"required"` Auth *AuthConfig `yaml:"auth" validate:"required"` Translator *TranslatorConfig `yaml:"translator" validate:"required"` Tatoeba *TatoebaConfig `yaml:"tatoeba" validate:"required"` Synthesizer *SynthesizerConfig `yaml:"synthesizer" validate:"required"` Trace *TraceConfog `yaml:"trace" validate:"required"` CORS *CORSConfig `yaml:"cors" validate:"required"` Shutdown *ShutdownConfig `yaml:"shutdown" validate:"required"` Log *LogConfig `yaml:"log" validate:"required"` Swagger *SwaggerConfig `yaml:"swagger" validate:"required"` Debug *DebugConfig `yaml:"debug"` }
func LoadConfig ¶
type DBConfig ¶
type DBConfig struct { DriverName string `yaml:"driverName"` SQLite3 *SQLite3Config `yaml:"sqlite3"` MySQL *MySQLConfig `yaml:"mysql"` }
type DebugConfig ¶
type JaegerConfig ¶
type JaegerConfig struct {
Endpoint string `yaml:"endpoint" validate:"required"`
}
type MySQLConfig ¶
type SQLite3Config ¶
type SQLite3Config struct {
File string `yaml:"file" validate:"required"`
}
type ShutdownConfig ¶
type SwaggerConfig ¶
type SynthesizerConfig ¶
type TatoebaConfig ¶
type TraceConfog ¶
type TraceConfog struct { Exporter string `yaml:"exporter" validate:"required"` Jaeger *JaegerConfig `yaml:"jaeger"` }
type TranslatorConfig ¶
type TranslatorConfig struct { Endpoint string `yaml:"endpoint" validate:"required"` TimeoutSec int `yaml:"timeoutSec" validate:"gte=1"` Username string `yaml:"username" validate:"required"` Password string `yaml:"password" validate:"required"` GRPCAddr string `yaml:"grpcAddr" validate:"required"` }
Click to show internal directories.
Click to hide internal directories.