config

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Sep 9, 2025 License: AGPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultConfigName = "config"
	DefaultConfigType = "yaml"
)
View Source
const DefaultRegion = "default"
View Source
const ServiceName = "resource-backend"

Variables

View Source
var (
	GConfig = new(Config)
)

Functions

func InitGlobalConfig added in v0.4.1

func InitGlobalConfig()

func NewConsulClient added in v0.4.1

func NewConsulClient() *api.Client

func RegisterKeyListener added in v0.4.1

func RegisterKeyListener(l KeyListener)

RegisterKeyListener use in init method don't dynamic update

Types

type AuthConfig

type AuthConfig struct {
	SignSecret            string `mapstructure:"sign_secret"`
	PrivateKey            string `mapstructure:"private_key"`
	UploaderValidationURL string `mapstructure:"uploader_validation_url"`
	CDKValidationURL      string `mapstructure:"cdk_validation_url"`
	DownloadValidationURL string `mapstructure:"download_validation_url"`
}

type Config

type Config struct {
	Instance InstanceConfig `mapstructure:"instance"`
	Log      LogConfig      `mapstructure:"log"`
	Registry Registration   `mapstructure:"registry"`
	Database DatabaseConfig `mapstructure:"database"`
	Auth     AuthConfig     `mapstructure:"auth"`
	Redis    RedisConfig    `mapstructure:"redis"`
	OSS      OSSConfig      `mapstructure:"oss"`
	Extra    ExtraConfig    `mapstructure:"extra"`
}

type DatabaseConfig

type DatabaseConfig struct {
	Host     string `mapstructure:"host"`
	Port     int    `mapstructure:"port"`
	Username string `mapstructure:"username"`
	Password string `mapstructure:"password"`
	Name     string `mapstructure:"name"`
}

type ExtraConfig added in v0.2.0

type ExtraConfig struct {
	DownloadPrefixInfo        map[string][]RobinServer `mapstructure:"download_prefix_info"`
	DownloadEffectiveTime     time.Duration            `mapstructure:"download_effective_time"`
	DownloadRedirectPrefix    string                   `mapstructure:"download_redirect_prefix"`
	SqlDebugMode              bool                     `mapstructure:"sql_debug_mode"`
	CreateNewVersionWebhook   string                   `mapstructure:"create_new_version_webhook"`
	CreateNewVersionBlacklist []string                 `mapstructure:"create_new_version_blacklist"`
	PurgeErrorWebhook         string                   `mapstructure:"purge_error_webhook"`
	CdnPrefix                 string                   `mapstructure:"cdn_prefix"`
	DistributeCdnRatio        int                      `mapstructure:"distribute_cdn_ratio"`
	DistributeCdnRegion       []string                 `mapstructure:"distribute_cdn_region"`
	Concurrency               int32                    `mapstructure:"concurrency"`
}

type InstanceConfig added in v0.4.1

type InstanceConfig struct {
	Address string
	Port    int `mapstructure:"port"`
	// only_local is used to indicate whether to only use local config
	OnlyLocal bool   `mapstructure:"only_local"`
	RegionId  string `mapstructure:"region_id"`
}

type KeyListener added in v0.4.1

type KeyListener struct {
	Key      string
	Listener func(any)
}

type LogConfig

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

type OSSConfig added in v0.5.0

type OSSConfig struct {
	ExternalHost string `mapstructure:"external_host"`
	Region       string `mapstructure:"region"`
	Endpoint     string `mapstructure:"endpoint"`
	AccessKey    string `mapstructure:"access_key"`
	SecretKey    string `mapstructure:"secret_key"`
	Bucket       string `mapstructure:"bucket"`
}

type RedisConfig added in v0.2.0

type RedisConfig struct {
	Addr     string `mapstructure:"addr"`
	Username string `mapstructure:"username"`
	Password string `mapstructure:"password"`
	Name     string `mapstructure:"name"`
	DB       int    `mapstructure:"db"`
	AsynqDB  int    `mapstructure:"asynq_db"`
}

type Registration added in v0.4.0

type Registration struct {
	Endpoint  string `mapstructure:"endpoint"`
	Path      string `mapstructure:"path"`
	ServiceId string `mapstructure:"service_id"`
}

type RobinServer added in v0.4.1

type RobinServer struct {
	Url    string `mapstructure:"url"`
	Weight int    `mapstructure:"weight"`
}

Jump to

Keyboard shortcuts

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