config

package
v0.0.0-...-e0d14af Latest Latest
Warning

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

Go to latest
Published: Oct 16, 2022 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InitCORS

func InitCORS(cfg *CORSConfig) cors.Config

func InitDB

func InitDB(cfg *DBConfig) (*gorm.DB, *sql.DB, error)

func InitLog

func InitLog(env string, cfg *LogConfig) error

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"`
}

type AuthConfig

type AuthConfig struct {
	Username string `yaml:"username" validate:"required"`
	Password string `yaml:"password" validate:"required"`
}

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"`
	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"`
	Debug       *DebugConfig       `yaml:"debug"`
	Swagger     *SwaggerConfig     `yaml:"swagger" validate:"required"`
}

func LoadConfig

func LoadConfig(env string) (*Config, error)

type DBConfig

type DBConfig struct {
	DriverName string         `yaml:"driverName"`
	SQLite3    *SQLite3Config `yaml:"sqlite3"`
	MySQL      *MySQLConfig   `yaml:"mysql"`
}

type DebugConfig

type DebugConfig struct {
	GinMode bool `yaml:"ginMode"`
	Wait    bool `yaml:"wait"`
}

type JaegerConfig

type JaegerConfig struct {
	Endpoint string `yaml:"endpoint" validate:"required"`
}

type LogConfig

type LogConfig struct {
	Level string `yaml:"level"`
}

type MySQLConfig

type MySQLConfig struct {
	Username string `yaml:"username" validate:"required"`
	Password string `yaml:"password" validate:"required"`
	Host     string `yaml:"host" validate:"required"`
	Port     int    `yaml:"port" validate:"required"`
	Database string `yaml:"database" validate:"required"`
}

type SQLite3Config

type SQLite3Config struct {
	File string `yaml:"file" validate:"required"`
}

type ShutdownConfig

type ShutdownConfig struct {
	TimeSec1 int `yaml:"timeSec1" validate:"gte=1"`
	TimeSec2 int `yaml:"timeSec2" validate:"gte=1"`
}

type SwaggerConfig

type SwaggerConfig struct {
	Enabled bool   `yaml:"enabled"`
	Host    string `yaml:"host"`
	Schema  string `yaml:"schema"`
}

type SynthesizerConfig

type SynthesizerConfig struct {
	Key        string `yaml:"key" validate:"required"`
	TimeoutSec int    `yaml:"timeoutSec" validate:"gte=1"`
}

type TraceConfog

type TraceConfog struct {
	Exporter string        `yaml:"exporter" validate:"required"`
	Jaeger   *JaegerConfig `yaml:"jaeger"`
}

Jump to

Keyboard shortcuts

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