Documentation ¶
Index ¶
Constants ¶
View Source
const ( // CacheOptionPrefix key prefix for option cache CacheOptionPrefix = "PUTI_OPTION_" // CachePostCounterKey key of post counter cache, store all post's count number as a map CachePostCounterKey = "PUTI_POST_VIEWS_CACHE" // CachePostCounterIPPoolKeyPrefix key prefix, IP Pool was be designed as a single key/value cache CachePostCounterIPPoolKeyPrefix = "PUTI_POST_VIEWS_CACHE_IP_" // CachePageDetailPrefix key prefix for page cache CachePageDetailPrefix = "PUTI_PAGE_" // CacheArticleDetailPrefix key prefix for article cache CacheArticleDetailPrefix = "PUTI_ARTICLE_" // CacheKnowledgeInfoPrefix key prefix for knowledge info CacheKnowledgeInfoPrefix = "PUTI_K_" // CacheKnowledgeItemListPrefix key prefix for knowledge item list CacheKnowledgeItemListPrefix = "PUTI_KITEM_" // CacheKnowledgeItemContentPrefix key prefix for knowledge item content CacheKnowledgeItemContentPrefix = "PUTI_KITEM_CONTENT_" )
View Source
const ( PathRoot = "/" PathBackend = "/admin" PathAPI = "/api" PathArticle = "/article" PathCategory = "/category" PathTag = "/tag" PathSubject = "/subject" PathArchives = "/archives" PathRSS = "/rss" PathSiteMap = "/sitemap.xml" PathRobots = "/robots.txt" PathFavicon = "/favicon.ico" )
router path config
View Source
const ( StaticPathRoot = "" StaticPathTheme = "theme" )
static path config
View Source
const ( // UploadPath defines the media file save path uri UploadPath = "/uploads/" // savePath defines the use avatar saving path UploadUserAvatarPath = "/uploads/users/" )
upload path config
Variables ¶
View Source
var ( Server *ServerConfig Safety *SafetyConfig Log *LogConfig Db *DbConfig )
Functions ¶
func InitConfig ¶
NewConfig set up viper config and return a Config struct instance
func StaticPath ¶
StaticPath change path to static path base on the StaticPathRoot
Types ¶
type Config ¶
type Config struct {
// contains filtered or unexported fields
}
Config instance struct of config
type DbConfig ¶
type DbConfig struct { DbType string `mapstructure:"db_type"` Name string `mapstructure:"name"` Addr string `mapstructure:"addr"` Username string `mapstructure:"username"` Password string `mapstructure:"password"` MaxIdleConns int `mapstructure:"max_idle_conns"` MaxOpenConns int `mapstructure:"max_open_conns"` }
type SafetyConfig ¶
type SafetyConfig struct {
JwtSecret string `mapstructure:"jwt_secret"`
}
type ServerConfig ¶
type ServerConfig struct { Runmode string `mapstructure:"runmode"` Name string `mapstructure:"name"` HttpPort string `mapstructure:"http_port"` HttpsOpen bool `mapstructure:"https_open"` HttpsPort string `mapstructure:"https_port"` AutoCert bool `mapstructure:"auto_cert"` TlsCert string `mapstructure:"tls_cert"` TlsKey string `mapstructure:"tls_key"` PutiDomain []string `mapstructure:"puti_domain"` }
Click to show internal directories.
Click to hide internal directories.