Add config option: Picture cache path
This commit is contained in:
parent
76cd448e79
commit
7a1ff8636c
|
@ -44,6 +44,8 @@ REGISTER_EMAIL_CONFIRM = false
|
||||||
DISENABLE_REGISTERATION = false
|
DISENABLE_REGISTERATION = false
|
||||||
; User must sign in to view anything.
|
; User must sign in to view anything.
|
||||||
REQUIRE_SIGNIN_VIEW = false
|
REQUIRE_SIGNIN_VIEW = false
|
||||||
|
; Cache avatar as picture
|
||||||
|
ENABLE_CACHE_AVATAR = false
|
||||||
|
|
||||||
[mailer]
|
[mailer]
|
||||||
ENABLED = false
|
ENABLED = false
|
||||||
|
@ -70,6 +72,12 @@ INTERVAL = 60
|
||||||
; memcache: "127.0.0.1:11211"
|
; memcache: "127.0.0.1:11211"
|
||||||
HOST =
|
HOST =
|
||||||
|
|
||||||
|
[picture]
|
||||||
|
; The place to picture data, either "server" or "qiniu", default is "server"
|
||||||
|
SERVICE = server
|
||||||
|
; For "server" only, root path of picture data, default is "data/pictures"
|
||||||
|
PATH = data/pictures
|
||||||
|
|
||||||
[log]
|
[log]
|
||||||
; Either "console", "file", "conn" or "smtp", default is "console"
|
; Either "console", "file", "conn" or "smtp", default is "console"
|
||||||
MODE = console
|
MODE = console
|
||||||
|
|
|
@ -44,6 +44,9 @@ var (
|
||||||
CacheAdapter string
|
CacheAdapter string
|
||||||
CacheConfig string
|
CacheConfig string
|
||||||
|
|
||||||
|
PictureService string
|
||||||
|
PictureRootPath string
|
||||||
|
|
||||||
LogMode string
|
LogMode string
|
||||||
LogConfig string
|
LogConfig string
|
||||||
)
|
)
|
||||||
|
@ -52,6 +55,7 @@ var Service struct {
|
||||||
RegisterEmailConfirm bool
|
RegisterEmailConfirm bool
|
||||||
DisenableRegisteration bool
|
DisenableRegisteration bool
|
||||||
RequireSignInView bool
|
RequireSignInView bool
|
||||||
|
EnableCacheAvatar bool
|
||||||
ActiveCodeLives int
|
ActiveCodeLives int
|
||||||
ResetPwdCodeLives int
|
ResetPwdCodeLives int
|
||||||
}
|
}
|
||||||
|
@ -82,6 +86,7 @@ func newService() {
|
||||||
Service.ResetPwdCodeLives = Cfg.MustInt("service", "RESET_PASSWD_CODE_LIVE_MINUTES", 180)
|
Service.ResetPwdCodeLives = Cfg.MustInt("service", "RESET_PASSWD_CODE_LIVE_MINUTES", 180)
|
||||||
Service.DisenableRegisteration = Cfg.MustBool("service", "DISENABLE_REGISTERATION", false)
|
Service.DisenableRegisteration = Cfg.MustBool("service", "DISENABLE_REGISTERATION", false)
|
||||||
Service.RequireSignInView = Cfg.MustBool("service", "REQUIRE_SIGNIN_VIEW", false)
|
Service.RequireSignInView = Cfg.MustBool("service", "REQUIRE_SIGNIN_VIEW", false)
|
||||||
|
Service.EnableCacheAvatar = Cfg.MustBool("service", "ENABLE_CACHE_AVATAR", false)
|
||||||
}
|
}
|
||||||
|
|
||||||
func newLogService() {
|
func newLogService() {
|
||||||
|
@ -214,6 +219,9 @@ func NewConfigContext() {
|
||||||
SecretKey = Cfg.MustValue("security", "SECRET_KEY")
|
SecretKey = Cfg.MustValue("security", "SECRET_KEY")
|
||||||
RunUser = Cfg.MustValue("", "RUN_USER")
|
RunUser = Cfg.MustValue("", "RUN_USER")
|
||||||
|
|
||||||
|
PictureService = Cfg.MustValue("picture", "SERVICE")
|
||||||
|
PictureRootPath = Cfg.MustValue("picture", "PATH")
|
||||||
|
|
||||||
// Determine and create root git reposiroty path.
|
// Determine and create root git reposiroty path.
|
||||||
RepoRootPath = Cfg.MustValue("repository", "ROOT")
|
RepoRootPath = Cfg.MustValue("repository", "ROOT")
|
||||||
if err = os.MkdirAll(RepoRootPath, os.ModePerm); err != nil {
|
if err = os.MkdirAll(RepoRootPath, os.ModePerm); err != nil {
|
||||||
|
|
|
@ -70,6 +70,9 @@ func Config(ctx *middleware.Context) {
|
||||||
ctx.Data["CacheAdapter"] = base.CacheAdapter
|
ctx.Data["CacheAdapter"] = base.CacheAdapter
|
||||||
ctx.Data["CacheConfig"] = base.CacheConfig
|
ctx.Data["CacheConfig"] = base.CacheConfig
|
||||||
|
|
||||||
|
ctx.Data["PictureService"] = base.PictureService
|
||||||
|
ctx.Data["PictureRootPath"] = base.PictureRootPath
|
||||||
|
|
||||||
ctx.Data["LogMode"] = base.LogMode
|
ctx.Data["LogMode"] = base.LogMode
|
||||||
ctx.Data["LogConfig"] = base.LogConfig
|
ctx.Data["LogConfig"] = base.LogConfig
|
||||||
|
|
||||||
|
|
|
@ -45,6 +45,7 @@
|
||||||
<div><b>Register Email Confirmation:</b> <i class="fa fa{{if .Service.RegisterEmailConfirm}}-check{{end}}-square-o"></i></div>
|
<div><b>Register Email Confirmation:</b> <i class="fa fa{{if .Service.RegisterEmailConfirm}}-check{{end}}-square-o"></i></div>
|
||||||
<div><b>Disenable Registeration:</b> <i class="fa fa{{if .Service.DisenableRegisteration}}-check{{end}}-square-o"></i></div>
|
<div><b>Disenable Registeration:</b> <i class="fa fa{{if .Service.DisenableRegisteration}}-check{{end}}-square-o"></i></div>
|
||||||
<div><b>Require Sign In View:</b> <i class="fa fa{{if .Service.RequireSignInView}}-check{{end}}-square-o"></i></div>
|
<div><b>Require Sign In View:</b> <i class="fa fa{{if .Service.RequireSignInView}}-check{{end}}-square-o"></i></div>
|
||||||
|
<div><b>Enable Cache Avatar:</b> <i class="fa fa{{if .Service.EnableCacheAvatar}}-check{{end}}-square-o"></i></div>
|
||||||
<hr/>
|
<hr/>
|
||||||
<div><b>Active Code Lives:</b> {{.Service.ActiveCodeLives}} minutes</div>
|
<div><b>Active Code Lives:</b> {{.Service.ActiveCodeLives}} minutes</div>
|
||||||
<div><b>Reset Password Code Lives:</b> {{.Service.ResetPwdCodeLives}} minutes</div>
|
<div><b>Reset Password Code Lives:</b> {{.Service.ResetPwdCodeLives}} minutes</div>
|
||||||
|
@ -76,6 +77,17 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="panel panel-default">
|
||||||
|
<div class="panel-heading">
|
||||||
|
Picture Configuration
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="panel-body">
|
||||||
|
<div><b>Picture Service:</b> {{.PictureService}}</div>
|
||||||
|
<div><b>Picture Root Path:</b> {{.PictureRootPath}}</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="panel panel-default">
|
<div class="panel panel-default">
|
||||||
<div class="panel-heading">
|
<div class="panel-heading">
|
||||||
Log Configuration
|
Log Configuration
|
||||||
|
|
Loading…
Reference in New Issue