config

package
v0.0.12 Latest Latest
Warning

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

Go to latest
Published: Jan 29, 2024 License: MIT Imports: 20 Imported by: 13

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, sqlFSs ...fs.FS) (libgateway.DialectRDBMS, *gorm.DB, *sql.DB, error)

func InitLog

func InitLog(cfg *LogConfig) error

func InitTracerProvider

func InitTracerProvider(ctx context.Context, appName string, traceConfig *TraceConfig) (*sdktrace.TracerProvider, error)

Types

type CORSConfig

type CORSConfig struct {
	AllowOrigins []string `yaml:"allowOrigins"`
}

type DBConfig

type DBConfig struct {
	DriverName string          `yaml:"driverName"`
	SQLite3    *SQLite3Config  `yaml:"sqlite3"`
	MySQL      *MySQLConfig    `yaml:"mysql"`
	Postgres   *PostgresConfig `yaml:"postgres"`
	Migration  bool            `yaml:"migration"`
}

type LogConfig

type LogConfig struct {
	Level map[string]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 OTLPConfig

type OTLPConfig struct {
	Endpoint string `yaml:"endpoint" validate:"required"`
	Insecure bool   `yaml:"insecure"`
}

type PostgresConfig added in v0.0.8

type PostgresConfig 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 SwaggerConfig

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

type TraceConfig

type TraceConfig struct {
	Exporter string      `yaml:"exporter" validate:"required"`
	OTLP     *OTLPConfig `yaml:"otlp"`
}

Jump to

Keyboard shortcuts

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