Documentation
¶
Index ¶
- Constants
- func GetCfgFileLoaded() string
- func Init(cfgFile string)
- type AdminEmailConf
- type AdminNotifyConf
- type AdminUserConf
- type AliDMConf
- type AliyunAntispamConf
- type CacheConf
- type CacheType
- type CaptchaConf
- type Config
- type CookieConf
- type DBConf
- type DBType
- type EmailConf
- type EmailSenderType
- type GeetestConf
- type ImgUploadConf
- type KeyWordsAntispamConf
- type LogConf
- type ModeratorConf
- type NotifyBarkConf
- type NotifyDingTalkConf
- type NotifyLINEConf
- type NotifyLarkConf
- type NotifySlackConf
- type NotifyTelegramConf
- type NotifyWebHookConf
- type RedisConf
- type SMTPConf
- type SSLConf
- type TencentAntispamConf
- type UpgitConf
Constants ¶
View Source
const DEFAULT_CONF_FILE = "artalk-go.yml"
Variables ¶
This section is empty.
Functions ¶
func GetCfgFileLoaded ¶
func GetCfgFileLoaded() string
Types ¶
type AdminEmailConf ¶
type AdminNotifyConf ¶
type AdminNotifyConf struct {
NotifyTpl string `koanf:"notify_tpl" json:"notify_tpl"` // 通知模板
NotifySubject string `koanf:"notify_subject" json:"notify_subject"` // 通知标题
Email *AdminEmailConf `koanf:"email" json:"email"` // 邮件通知
Telegram NotifyTelegramConf `koanf:"telegram" json:"telegram"` // TG
Lark NotifyLarkConf `koanf:"lark" json:"lark"` // 飞书
DingTalk NotifyDingTalkConf `koanf:"ding_talk" json:"ding_talk"` // 钉钉
Bark NotifyBarkConf `koanf:"bark" json:"bark"` // bark
Slack NotifySlackConf `koanf:"slack" json:"slack"` // slack
LINE NotifyLINEConf `koanf:"line" json:"line"` // LINE
WebHook NotifyWebHookConf `koanf:"webhook" json:"webhook"` // WebHook
NoiseMode bool `koanf:"noise_mode" json:"noise_mode"` // 嘈杂模式 (非回复管理员的评论也发送通知)
}
其他通知方式
type AdminUserConf ¶
type AdminUserConf struct {
Name string `koanf:"name" json:"name"`
Email string `koanf:"email" json:"email"`
Link string `koanf:"link" json:"link"`
Password string `koanf:"password" json:"password"`
BadgeName string `koanf:"badge_name" json:"badge_name"`
BadgeColor string `koanf:"badge_color" json:"badge_color"`
ReceiveEmail *bool `koanf:"receive_email" json:"receive_email"`
Sites []string `koanf:"sites" json:"sites"`
}
type AliyunAntispamConf ¶
type AliyunAntispamConf struct {
Enabled bool `koanf:"enabled" json:"enabled"`
AccessKeyID string `koanf:"access_key_id" json:"access_key_id"`
AccessKeySecret string `koanf:"access_key_secret" json:"access_key_secret"`
Region string `koanf:"region" json:"region"`
}
阿里云反垃圾
type CacheConf ¶
type CacheConf struct {
Enabled bool // 配置文件不允许修改
Type CacheType `koanf:"type" json:"type"`
Expires int `koanf:"expires" json:"expires"` // 过期时间
WarmUp bool `koanf:"warm_up" json:"warm_up"` // 启动时缓存预热
Server string `koanf:"server" json:"server"` // 缓存服务器
Redis RedisConf `koanf:"redis" json:"redis"`
}
func (*CacheConf) GetExpiresTime ¶
type CaptchaConf ¶
type CaptchaConf struct {
Enabled bool `koanf:"enabled" json:"enabled"`
Always bool `koanf:"always" json:"always"`
ActionTimeout int `koanf:"action_timeout" json:"-"` // @deprecated 已废弃 (请使用 ActionReset)
ActionReset int `koanf:"action_reset" json:"action_reset"`
ActionLimit int `koanf:"action_limit" json:"action_limit"`
Geetest GeetestConf `koanf:"geetest" json:"geetest"`
}
type Config ¶
type Config struct {
AppKey string `koanf:"app_key" json:"app_key"` // 加密密钥
Debug bool `koanf:"debug" json:"debug"` // 调试模式
TimeZone string `koanf:"timezone" json:"timezone"` // 时区
Host string `koanf:"host" json:"host"` // HTTP Server 监听 IP
Port int `koanf:"port" json:"port"` // HTTP Server 监听 Port
DB DBConf `koanf:"db" json:"db"` // 数据文件
Cache CacheConf `koanf:"cache" json:"cache"` // 缓存
Log LogConf `koanf:"log" json:"log"` // 日志文件
AllowOrigins []string `koanf:"allow_origins" json:"-"` // @deprecated 已废弃 (请使用 TrustedDomains)
TrustedDomains []string `koanf:"trusted_domains" json:"trusted_domains"` // 可信任的域名 (新)
SSL SSLConf `koanf:"ssl" json:"ssl"` // SSL
SiteDefault string `koanf:"site_default" json:"site_default"` // 默认站点名(当请求无指定 site_name 时使用)
AdminUsers []AdminUserConf `koanf:"admin_users" json:"admin_users"` // 管理员账户
LoginTimeout int `koanf:"login_timeout" json:"login_timeout"` // 登陆超时
Cookie CookieConf `koanf:"cookie" json:"cookie"` // Cookie
Moderator ModeratorConf `koanf:"moderator" json:"moderator"` // 评论审查
Captcha CaptchaConf `koanf:"captcha" json:"captcha"` // 验证码
Email EmailConf `koanf:"email" json:"email"` // 邮箱提醒
ImgUpload ImgUploadConf `koanf:"img_upload" json:"img_upload"` // 图片上传
AdminNotify AdminNotifyConf `koanf:"admin_notify" json:"admin_notify"` // 其他通知方式
Notify *AdminNotifyConf `koanf:"notify" json:"-"` // @deprecated 已废弃 (请使用 AdminNotify)
Frontend map[string]interface{} `koanf:"frontend" json:"frontend"`
}
Config 配置 @link https://godoc.org/github.com/mitchellh/mapstructure
var ( // 配置实例 Instance *Config )
type CookieConf ¶
type CookieConf struct {
Enabled bool `koanf:"enabled" json:"enabled"`
}
type DBConf ¶
type DBConf struct {
Type DBType `koanf:"type" json:"type"`
Dsn string `koanf:"dsn" json:"dsn"` // 最高优先级
File string `koanf:"file" json:"file"`
Name string `koanf:"name" json:"name"`
Host string `koanf:"host" json:"host"`
Port int `koanf:"port" json:"port"`
User string `koanf:"user" json:"user"`
Password string `koanf:"password" json:"password"`
TablePrefix string `koanf:"table_prefix" json:"table_prefix"`
Charset string `koanf:"charset" json:"charset"`
}
type EmailConf ¶
type EmailConf struct {
Enabled bool `koanf:"enabled" json:"enabled"` // 总开关
SendType EmailSenderType `koanf:"send_type" json:"send_type"` // 发送方式
SendName string `koanf:"send_name" json:"send_name"` // 发件人名
SendAddr string `koanf:"send_addr" json:"send_addr"` // 发件人地址
MailSubject string `koanf:"mail_subject" json:"mail_subject"` // 邮件标题
MailSubjectToAdmin string `koanf:"mail_subject_to_admin" json:"-"` // @deprecated 已废弃 (请使用 AdminNotify.Email.MailSubject) - 邮件标题 (发送给管理员用)
MailTpl string `koanf:"mail_tpl" json:"mail_tpl"` // 邮件模板
SMTP SMTPConf `koanf:"smtp" json:"smtp"` // SMTP 配置
AliDM AliDMConf `koanf:"ali_dm" json:"ali_dm"` // 阿里云邮件配置
}
type EmailSenderType ¶
type EmailSenderType string
const ( TypeSMTP EmailSenderType = "smtp" TypeAliDM EmailSenderType = "ali_dm" TypeSendmail EmailSenderType = "sendmail" )
type GeetestConf ¶
type ImgUploadConf ¶
type ImgUploadConf struct {
Enabled bool `koanf:"enabled" json:"enabled"` // 总开关
Path string `koanf:"path" json:"path"` // 图片存放路径
MaxSize int64 `koanf:"max_size" json:"max_size"` // 图片大小限制
Quality string `koanf:"quality" json:"quality"` // 图片质量
PublicPath string `koanf:"public_path" json:"public_path"` // 图片 URL 基础路径
Upgit UpgitConf `koanf:"upgit" json:"upgit"` // upgit
}
type KeyWordsAntispamConf ¶
type KeyWordsAntispamConf struct {
Enabled bool `koanf:"enabled" json:"enabled"`
Pending bool `koanf:"pending" json:"pending"`
Files []string `koanf:"files" json:"files"`
FileSep string `koanf:"file_sep" json:"file_sep"`
ReplacTo string `koanf:"replac_to" json:"replac_to"`
}
关键词词库过滤
type ModeratorConf ¶
type ModeratorConf struct {
PendingDefault bool `koanf:"pending_default" json:"pending_default"`
ApiFailBlock bool `koanf:"api_fail_block" json:"api_fail_block"` // API 请求错误仍然拦截
AkismetKey string `koanf:"akismet_key" json:"akismet_key"`
Tencent TencentAntispamConf `koanf:"tencent" json:"tencent"`
Aliyun AliyunAntispamConf `koanf:"aliyun" json:"aliyun"`
Keywords KeyWordsAntispamConf `koanf:"keywords" json:"keywords"`
}
type NotifyBarkConf ¶
type NotifyDingTalkConf ¶
type NotifyLINEConf ¶
type NotifyLarkConf ¶
type NotifySlackConf ¶
type NotifyTelegramConf ¶
type NotifyWebHookConf ¶
type RedisConf ¶
type RedisConf struct {
Network string `koanf:"network" json:"network"` // tcp or unix
Username string `koanf:"username" json:"username"`
Password string `koanf:"password" json:"password"`
DB int `koanf:"db" json:"db"` // Redis 默认数据库 0
}
# Redis 配置 redis:
network: "tcp" username: "" password: "" db: 0
Click to show internal directories.
Click to hide internal directories.