aboutsummaryrefslogtreecommitdiff
path: root/modules/setting
diff options
context:
space:
mode:
author无闻 <joe2010xtmf@163.com>2014-07-24 12:47:55 -0400
committer无闻 <joe2010xtmf@163.com>2014-07-24 12:47:55 -0400
commitda0240aacd5646bd73b2e22d92d88578dbafd64b (patch)
tree3c101530bc7f1b9f4677cab0be4e8a3e4175c50b /modules/setting
parent3db84c889365a559a6ea81ad4e7dd4a5f089d249 (diff)
parent9a7349ce64afdbc528126862283b1068d4c8699a (diff)
Merge pull request #307 from nuss-justin/feature/attachments
Feature: Ability to attach files to issues (attachments)
Diffstat (limited to 'modules/setting')
-rw-r--r--modules/setting/setting.go17
1 files changed, 17 insertions, 0 deletions
diff --git a/modules/setting/setting.go b/modules/setting/setting.go
index f03aa8ae..569d1bd1 100644
--- a/modules/setting/setting.go
+++ b/modules/setting/setting.go
@@ -71,6 +71,13 @@ var (
LogModes []string
LogConfigs []string
+ // Attachment settings.
+ AttachmentPath string
+ AttachmentAllowedTypes string
+ AttachmentMaxSize int64
+ AttachmentMaxFiles int
+ AttachmentEnabled bool
+
// Cache settings.
Cache cache.Cache
CacheAdapter string
@@ -166,6 +173,16 @@ func NewConfigContext() {
CookieRememberName = Cfg.MustValue("security", "COOKIE_REMEMBER_NAME")
ReverseProxyAuthUser = Cfg.MustValue("security", "REVERSE_PROXY_AUTHENTICATION_USER", "X-WEBAUTH-USER")
+ AttachmentPath = Cfg.MustValue("attachment", "PATH", "files/attachments")
+ AttachmentAllowedTypes = Cfg.MustValue("attachment", "ALLOWED_TYPES", "*/*")
+ AttachmentMaxSize = Cfg.MustInt64("attachment", "MAX_SIZE", 32)
+ AttachmentMaxFiles = Cfg.MustInt("attachment", "MAX_FILES", 10)
+ AttachmentEnabled = Cfg.MustBool("attachment", "ENABLE", true)
+
+ if err = os.MkdirAll(AttachmentPath, os.ModePerm); err != nil {
+ log.Fatal("Could not create directory %s: %s", AttachmentPath, err)
+ }
+
RunUser = Cfg.MustValue("", "RUN_USER")
curUser := os.Getenv("USER")
if len(curUser) == 0 {