config

package
v0.0.0-...-078f527 Latest Latest
Warning

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

Go to latest
Published: Sep 1, 2023 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrConfigNotFound is returned when config file is not found
	ErrConfigNotFound = errors.New("config file not found")
	// ErrConfigInvalid is returned when config file is invalid
	ErrConfigInvalid = errors.New("config file is invalid")
	// ErrConfigUnmarshal is returned when config file cannot be unmarshalled
	ErrConfigUnmarshal = errors.New("config file cannot be unmarshalled")
)
View Source
var Module = fx.Module("config", fx.Options(
	fx.Provide(NewConfig),
))

package bootstrap

Functions

This section is empty.

Types

type AliyunConfig

type AliyunConfig struct{}

type AnalyticsDBConfig

type AnalyticsDBConfig struct {
	Driver     string           `yaml:"driver"`
	Clickhouse ClickhouseConfig `yaml:"clickhouse"`
}

type AppConfig

type AppConfig struct {
	Name    string `yaml:"name"`
	Version string `yaml:"version"`
	Port    int    `yaml:"port"`
	Host    string `yaml:"host"`
}

type BackendConfig

type BackendConfig struct {
	Driver DatabaseDriver `yaml:"driver"`
	Mysql  MysqlConfig    `yaml:"mysql"`
	Tidb   TidbConfig     `yaml:"tidb"`
}

type CacheConfig

type CacheConfig struct {
	Driver    string      `yaml:"driver"`
	KeyPrefix string      `yaml:"key_prefix"`
	Redis     RedisConfig `yaml:"redis"`
}

type ClickhouseConfig

type ClickhouseConfig struct {
	Host               string `yaml:"host"`
	Port               int    `yaml:"port"`
	User               string `yaml:"user"`
	Password           string `yaml:"password"`
	Database           string `yaml:"database"`
	MaxConnections     int    `yaml:"max_connections"`
	MaxIdleConnections int    `yaml:"max_idle_connections"`
	MaxIdleTime        int    `yaml:"max_idle_time"`
}

type Config

type Config struct {
	Env      string         `yaml:"env"`
	App      AppConfig      `yaml:"app"`
	Log      LogConfig      `yaml:"log"`
	Database DatabaseConfig `yaml:"database"`
	Cache    CacheConfig    `yaml:"cache"`
	Worker   WorkerConfig   `yaml:"worker"`
	Services ServicesConfig `yaml:"services"`
}

func NewConfig

func NewConfig() (*Config, error)

NewConfig is a constructor for Config

type DatabaseConfig

type DatabaseConfig struct {
	Backend   BackendConfig     `yaml:"backend"`
	Analytics AnalyticsDBConfig `yaml:"analytics"`
	KeyValue  KeyValueConfig    `yaml:"key_value"`
}

type DatabaseDriver

type DatabaseDriver string
const (
	DatabaseDriverMysql DatabaseDriver = "mysql"
	DatabaseDriverTidb  DatabaseDriver = "tidb"
)

type EmailConfig

type EmailConfig struct {
	Driver string     `yaml:"driver"`
	SMTP   SMTPConfig `yaml:"smtp"`
}

type KeyValueConfig

type KeyValueConfig struct {
	Driver string      `yaml:"driver"`
	Redis  RedisConfig `yaml:"redis"`
}

type LogConfig

type LogConfig struct {
	Level      string `yaml:"level"`
	Format     string `yaml:"format"`
	Output     string `yaml:"output"`
	File       string `yaml:"file"`
	MaxSize    int    `yaml:"max_size"`
	MaxAge     int    `yaml:"max_age"`
	MaxBackups int    `yaml:"max_backups"`
	Compress   bool   `yaml:"compress"`
}

type MysqlConfig

type MysqlConfig struct {
	Host               string `yaml:"host"`
	Port               int    `yaml:"port"`
	User               string `yaml:"user"`
	Password           string `yaml:"password"`
	Database           string `yaml:"database"`
	Charset            string `yaml:"charset"`
	ParseTime          bool   `yaml:"parseTime"`
	Loc                string `yaml:"loc"`
	MaxConnections     int    `yaml:"max_connections"`
	MaxIdleConnections int    `yaml:"max_idle_connections"`
	MaxIdleTime        int    `yaml:"max_idle_time"`
	MigrationPath      string `yaml:"migration_path"`
}

type OauthAppleConfig

type OauthAppleConfig struct {
	ClientID     string `yaml:"client_id"`
	ClientSecret string `yaml:"client_secret"`
	RedirectURL  string `yaml:"redirect_url"`
}

type OauthConfig

type OauthConfig struct {
	Facebook OauthFacebookConfig `yaml:"facebook"`
	Google   OauthGoogleConfig   `yaml:"google"`
	Tiktok   OauthTiktokConfig   `yaml:"tiktok"`
	Apple    OauthAppleConfig    `yaml:"apple"`
}

oauth facebook & google config struct social login with facebook,tiktok,google, apple

type OauthFacebookConfig

type OauthFacebookConfig struct {
	ClientID     string `yaml:"client_id"`
	ClientSecret string `yaml:"client_secret"`
	RedirectURL  string `yaml:"redirect_url"`
}

facebook config struct

type OauthGoogleConfig

type OauthGoogleConfig struct {
	ClientID     string `yaml:"client_id"`
	ClientSecret string `yaml:"client_secret"`
	RedirectURL  string `yaml:"redirect_url"`
}

google config struct

type OauthTiktokConfig

type OauthTiktokConfig struct {
	ClientID     string `yaml:"client_id"`
	ClientSecret string `yaml:"client_secret"`
	RedirectURL  string `yaml:"redirect_url"`
}

type RedisConfig

type RedisConfig struct {
	Addr     string `yaml:"addr"`
	Password string `yaml:"password"`
	DB       int    `yaml:"db"`
}

type SMSConfig

type SMSConfig struct {
	Driver string       `yaml:"driver"`
	Aliyun AliyunConfig `yaml:"aliyun"`
}

type SMTPConfig

type SMTPConfig struct{}

type ServicesConfig

type ServicesConfig struct {
	SMS   SMSConfig   `yaml:"sms"`
	Email EmailConfig `yaml:"email"`
}

type TidbConfig

type TidbConfig struct {
	Host               string `yaml:"host"`
	Port               int    `yaml:"port"`
	User               string `yaml:"user"`
	Password           string `yaml:"password"`
	Database           string `yaml:"database"`
	Charset            string `yaml:"charset"`
	ParseTime          bool   `yaml:"parseTime"`
	Loc                string `yaml:"loc"`
	MaxConnections     int    `yaml:"max_connections"`
	MaxIdleConnections int    `yaml:"max_idle_connections"`
	MaxIdleTime        int    `yaml:"max_idle_time"`
	MigrationPath      string `yaml:"migration_path"`
}

type WorkerConfig

type WorkerConfig struct {
	Driver string         `yaml:"driver"`
	Queues map[string]int `yaml:"queues"`
	Redis  RedisConfig    `yaml:"redis"`
}

Jump to

Keyboard shortcuts

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