config

package
v0.28.2 Latest Latest
Warning

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

Go to latest
Published: Nov 4, 2022 License: AGPL-3.0, AGPL-3.0-only Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const Development = false
View Source
const RedisKeyPrefix = "chii:" + Version + ":"

RedisKeyPrefix is redis key prefix for all app keys Put version in cache key to avoid model changes.

View Source
const Version = "v0.28.2"

Variables

View Source
var Module = fx.Module("config",
	fx.Provide(
		NewAppConfig,
	),
)

Functions

This section is empty.

Types

type AppConfig

type AppConfig struct {
	Debug struct {
		Gorm bool `yaml:"gorm"`
	} `yaml:"debug"`

	RedisURL      string `yaml:"redis_url" env:"REDIS_URI" env-default:"redis://127.0.0.1:6379/0"`
	MySQLHost     string `yaml:"mysql_host" env:"MYSQL_HOST" env-default:"127.0.0.1"`
	MySQLPort     string `yaml:"mysql_port" env:"MYSQL_PORT" env-default:"3306"`
	MySQLUserName string `yaml:"mysql_user" env:"MYSQL_USER" env-default:"user"`
	MySQLPassword string `yaml:"mysql_pass" env:"MYSQL_PASS" env-default:"password"`
	MySQLDatabase string `yaml:"mysql_db" env:"MYSQL_DB" env-default:"bangumi"`
	MySQLMaxConn  int    `yaml:"mysql_max_connection" env:"MYSQL_MAX_CONNECTION" env-default:"4"`

	WebDomain string `yaml:"web_domain" env:"WEB_DOMAIN"` // new frontend web page domain
	HTTPHost  string `yaml:"http_host" env:"HTTP_HOST" env-default:"127.0.0.1"`
	HTTPPort  int    `yaml:"http_port" env:"HTTP_PORT" env-default:"3000"`

	KafkaBroker      string   `yaml:"kafka_broker" env:"KAFKA_BROKER"`
	KafkaCanalTopics []string `yaml:"kafka_canal_topics"`

	MeiliSearchURL string `yaml:"meilisearch_url" env:"MEILISEARCH_URL"`
	MeiliSearchKey string `yaml:"meilisearch_key" env:"MEILISEARCH_KEY"`

	HCaptchaSecretKey string `yaml:"hcaptcha_secret_key" env:"HCAPTCHA_SECRET_KEY"`

	SlowSQLDuration time.Duration `yaml:"slow_sql_duration" env:"SLOW_SQL_DURATION"`

	NsfwWord     string `yaml:"nsfw_word"`
	DisableWords string `yaml:"disable_words"`
	BannedDomain string `yaml:"banned_domain"`
}

func NewAppConfig

func NewAppConfig() (AppConfig, error)

func (AppConfig) ListenAddr added in v0.25.1

func (c AppConfig) ListenAddr() string

Jump to

Keyboard shortcuts

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