# __ .______ __ __ .______ .___________. ______ ______ .___ ___. # | | | _ \ | | | | | _ \ | | / | / __ \ | \/ | # | | | |_) | | |__| | | |_) | `---| |----` | ,----'| | | | | \ / | # | | | ___/ | __ | | ___/ | | | | | | | | | |\/| | # | | | | | | | | | | | | __ | `----.| `--' | | | | | # |__| | _| |__| |__| | _| |__| (__) \______| \______/ |__| |__| # ""$o o$"" ""$o o$" o "$""""o "o $" o""" $" "$o "$o" $o " $ o$" "$o $$$o$$$$o$$$$ $" "oooo o "" ""$$$$$$$$""o"" oo oooo" "$$$$$$oo"oo$$$o" o$$$$oo" o$$$o "o$$$$$$$ "$ $$$$$$$$$oo o$$$$$$$$$o"$" $ $$$ $$$$$$ o$$$$$$ "$$o"o $ $$$$o $$$$$$ $$$$$$$ $$$$o"o $ $$$$$ $$$$$" "$$$$$ $$$$$$ $ $o""""" """" """ """"""$" $ o$$$$$"""$$$$$"$$$$$""$$$$$ooo"o $ o"$o $$$$$$$$oo$$$$$$$$o $$"" $ oo$ "$$$$$$$$$$$$$$$$$$$$" o" o $oo o$$$"$ $$o"o $$$$$$$"" "$$$$$$$ o$$ $$$$o IPHPT BUG o$$$$" $ $$$$ o "$$$$$oo o$$$$$$ "o$$$$ $ $$$$$ o$$"" $ $$$$$o" "$$$$$$$$$$$$$ o o$$$$$o$ "" $$ $$" $ $$$" o"o$$$$$$$$$$$$ " "$$$ $ $$o o$$ "o $$ " $$$$$$$$$$$"o "$$ $ $$$ $$$ oo$ $ o""$$""$$$o " $"o$o $$$o o$$$$ o$$$"o"$oo$$$$o" o $o $$$$$oo$ $$$$o $$$$ $$$$ $$$$" $ $$$$$"" $$ o$$$ """$$$$"o" "$$$o "$$$o $$$" o """ $ $$$oo $$$$o" $$ o$$$"o" """"$ o$$$ o$" $$$ $ "$"" o$"o"$$o$$$$ "$$"o" o$$ "$oo $ " $$o $ "oo$"o$$$"o$o"$$$$o" o" $$$ ""$o $$ $$$o "o$$o$"$$"$$o$$o$$"$$o" $$$ ""o $$$ ""$$$ $$$$$$ $$$$ $" $$$$ $$ $$$$ $$$$"$$$o$ $"" $$$ $$$$ "$$$ """ $$$$ $$"" "$$ oo$" $ooo $ "$$ 关于go-blog的配置文件解析   -  叶落山城秋

关于go-blog的配置文件解析

go-blog 带了一个默认的配置文件, 构建项目的时候,请复制env.prod.yaml文件为 env.dev.yaml 或者 env.prod.yaml文件,来区分线上还是本地 如果不配置,将会走默认设置, 默认设置可能会影响代码正常运行

# 项目相关设置,可以直接修改这个或者复制这个后再填充参数


AppUrl: "" # 配置网站地址的
AppImgUrl: ""  # 网站图片地址 一般默认是 AppUrl + /static/uploads/images/

DefaultLimit: "20" # 后台数据列表每页条数
DefaultIndexLimit: "10" #前台数据列表每页条数

# 数据库相关设置
DbUser: ""
DbPassword: ""
DbPort: "3306"
DbDataBase: "go-blog"
DbHost: ""

# redis相关设置
RedisAddr: ""
RedisPwd: ""
RedisDb: 0

# github gitalk 相关设置
GithubName: "" # 你的github name
GithubRepo: "" # 你打算做评论的repo名字
GithubClientId: "" # 你设置的oauth的clientId
GithubClientSecret: "" # 你设置的oauth的clientSecret
GithubLabels: "Gitalk" # 默认为"Gitalk",你可以自由设置其他label,逗号隔开
 
# 七牛相关设置
QiNiuUploadImg: true # 是否把图片上传到七牛上
QiNiuHostName: "" 
QiNiuAccessKey: ""
QiNiuSecretKey: ""
QiNiuBucket: ""
QiNiuZone: "HUABEI" # you can use "HUADONG","HUABEI","BEIMEI","HUANAN","XINJIAPO"

# 报警相关设置 推荐邮件,因为我就实现了这个功能..
AlarmType: "mail,wechat"
MailUser: "" # 你的邮箱地址
MailPwd: "" # 你邮箱密码
MailHost: "" # 你邮箱的host,不知道的可以google一下

# 文章加入了 hashid的 功能,不过为了以前文章的迁移,这个功能写了,但并没有用,
HashIdSalt: "i must add a salt what is only for me"
HashIdLength: 8

# jwt 相关设置,请一定要单独设置这个,
JwtIss: ""
JwtAudience: ""
JwtJti: ""
JwtSecretKey: ""
JwtTokenLife: 3

# 腾讯的验证码,底层包有实现,不过我最后没用到这个项目里..主要是忘记了这事,自己找了个验证码的包自己实现了..
QCaptchaAid: ""
QCaptchaSecretKey: ""

# 项目有备份功能,默认都是这个目录.所以打包后,这个目录一定要带着,且有写权限
BackUpFilePath: "./backup/"
BackUpDuration: "@daily"
BackUpSentTo: "xzghua@gmail.com"

# 文章图 可以上传到本地也可以上传到七牛,功能已实现,默认同时上传,以防图片丢了..
DataCacheTimeDuration: 720
ImgUploadUrl: "" # AppUrl +"/console/post/imgUpload" 默认是你的项目地址+ /console/post/imgUpload
ImgUploadDst: "./static/uploads/images/" # 默认目录
ImgUploadBoth: true # img will upload to qiniu and your server local

# 缓存key
CateListKey: "all:cate:sort" # 后台分类列表默认缓存key
TagListKey: "all:tag" # 后台标签列表默认缓存key

# 网站首页进本配置
Theme: 0  # 以防以后多个主题,虽然我并没有做其他主题
Title: "叶落山城秋"
Keywords: "叶落山城秋"
Description: "叶落山城"
RecordNumber: "000-0000"
UserCnt: 2 # 允许最多注册几个用户,默认2个

# 前台一些缓存参数的key
PostIndexKey: "index:all:post:list"
TagPostIndexKey: "index:all:tag:post:list"
CatePostIndexKey: "index:all:cate:post:list"
LinkIndexKey: "index:all:link:list"
SystemIndexKey: "index:all:system:list"
PostDetailIndexKey: "index:post:detail"
ArchivesKey: "index:archives:list"

# 额外的js 你可以放一些 统计代码等等
OtherScript: "<script type=\"text/javascript\"></script>"

# 前台的静态文件,默认走服务器本地,你也设置成从cdn走,地址不同,但名字得一样
ThemeJs: "/static/home/assets/js"
ThemeCss: "/static/home/assets/css"
ThemeImg: "/static/home/assets/img"
ThemeFancyboxCss: "/static/home/assets/fancybox"
ThemeFancyboxJs: "/static/home/assets/fancybox"
ThemeHLightCss: "/static/home/assets/highlightjs"
ThemeHLightJs: "/static/home/assets/highlightjs"
ThemeShareCss: "/static/home/assets/css"
ThemeShareJs: "/static/home/assets/js"
ThemeArchivesJs: "/static/home/assets/js"
ThemeArchivesCss: "/static/home/assets/css"
ThemeNiceImg: "/static/home/assets/img"
ThemeAllCss: "/static/home/assets/css"
ThemeIndexImg: "/static/home/assets/img"
ThemeCateImg: "/static/home/assets/img"
ThemeTagImg: "/static/home/assets/img"

欢迎转载,但请附上原文地址哦,尊重原创,谢谢大家 本文地址: https://www.iphpt.com/detail/131/
本站(PHP --> Golang)已重构,代码开源

当你能力不能满足你的野心的时候,你就该沉下心来学习