config

package
v1.4.4 Latest Latest
Warning

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

Go to latest
Published: Nov 11, 2023 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ShortLinkNotFoundContentMode  = "content"
	ShortLinkNotFoundRedirectMode = "redirect"
	DefaultIdLength               = 6
	DefaultIdMinimumLength        = 2
	DefaultIdMaximumLength        = 10
)

Variables

This section is empty.

Functions

func GetConfig

func GetConfig() *reborn.Reborn

func SetupConfig added in v1.2.0

func SetupConfig(rdb *redis.Client) error

func UpdateIdConfig added in v1.4.1

func UpdateIdConfig(c *IdConfig)

func UpdateLandingHosts added in v1.4.1

func UpdateLandingHosts(hosts []string)

func UpdateShortLinkNotFoundConfig added in v1.4.1

func UpdateShortLinkNotFoundConfig(s *ShortLinkNotFoundConfig)

Types

type IdConfig added in v1.4.1

type IdConfig struct {
	// ID 长度
	IdLength int `json:"idLength" format:"int" example:"6"`

	// 最小 ID 长度
	IdMinimumLength int `json:"idMinimumLength" format:"int" example:"2"`

	// 最大 ID 长度
	IdMaximumLength int `json:"idMaximumLength" format:"int" example:"10"`

} // @name IdConfig

func GetIdConfig added in v1.4.1

func GetIdConfig() *IdConfig

type ShortLinkNotFoundConfig added in v1.4.1

type ShortLinkNotFoundConfig struct {
	// 模式
	Mode string `json:"mode" binding:"required" example:"content" enums:"content,redirect"`

	// 值
	Value string `json:"value" binding:"required" example:"page not found"`

} // @name ShortLinkNotFoundConfig

func GetShortLinkNotFoundConfig added in v1.4.1

func GetShortLinkNotFoundConfig() *ShortLinkNotFoundConfig

func (*ShortLinkNotFoundConfig) ToMap added in v1.4.1

func (s *ShortLinkNotFoundConfig) ToMap() map[string]string

type SystemConfig added in v1.4.1

type SystemConfig struct {
	// 落地页 Host 列表
	LandingHosts []string `json:"landingHosts" format:"array" example:"https://a.com/,https://b.com/"`

	// ID 配置
	IdConfig *IdConfig `json:"idConfig"`

	// 短链接 404 配置
	ShortLinkNotFoundConfig *ShortLinkNotFoundConfig `json:"shortLinkNotFoundConfig"`

} // @name SystemConfig

func GetSystemConfig added in v1.4.1

func GetSystemConfig() *SystemConfig

Jump to

Keyboard shortcuts

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