|
@ -11,6 +11,7 @@ import ( |
|
|
"path" |
|
|
"path" |
|
|
"path/filepath" |
|
|
"path/filepath" |
|
|
"strings" |
|
|
"strings" |
|
|
|
|
|
"time" |
|
|
|
|
|
|
|
|
"github.com/Unknwon/com" |
|
|
"github.com/Unknwon/com" |
|
|
"github.com/Unknwon/goconfig" |
|
|
"github.com/Unknwon/goconfig" |
|
@ -78,6 +79,9 @@ var ( |
|
|
AttachmentMaxFiles int |
|
|
AttachmentMaxFiles int |
|
|
AttachmentEnabled bool |
|
|
AttachmentEnabled bool |
|
|
|
|
|
|
|
|
|
|
|
// Time settings.
|
|
|
|
|
|
TimeFormat string |
|
|
|
|
|
|
|
|
// Cache settings.
|
|
|
// Cache settings.
|
|
|
Cache cache.Cache |
|
|
Cache cache.Cache |
|
|
CacheAdapter string |
|
|
CacheAdapter string |
|
@ -179,6 +183,55 @@ func NewConfigContext() { |
|
|
AttachmentMaxFiles = Cfg.MustInt("attachment", "MAX_FILES", 10) |
|
|
AttachmentMaxFiles = Cfg.MustInt("attachment", "MAX_FILES", 10) |
|
|
AttachmentEnabled = Cfg.MustBool("attachment", "ENABLE", true) |
|
|
AttachmentEnabled = Cfg.MustBool("attachment", "ENABLE", true) |
|
|
|
|
|
|
|
|
|
|
|
TimeFormat = Cfg.MustValue("time", "FORMAT", time.RFC1123) |
|
|
|
|
|
|
|
|
|
|
|
switch TimeFormat { |
|
|
|
|
|
case "ANSIC": |
|
|
|
|
|
TimeFormat = time.ANSIC |
|
|
|
|
|
|
|
|
|
|
|
case "UnixDate": |
|
|
|
|
|
TimeFormat = time.UnixDate |
|
|
|
|
|
|
|
|
|
|
|
case "RubyDate": |
|
|
|
|
|
TimeFormat = time.RubyDate |
|
|
|
|
|
|
|
|
|
|
|
case "RFC822": |
|
|
|
|
|
TimeFormat = time.RFC822 |
|
|
|
|
|
|
|
|
|
|
|
case "RFC822Z": |
|
|
|
|
|
TimeFormat = time.RFC822Z |
|
|
|
|
|
|
|
|
|
|
|
case "RFC850": |
|
|
|
|
|
TimeFormat = time.RFC850 |
|
|
|
|
|
|
|
|
|
|
|
case "RFC1123": |
|
|
|
|
|
TimeFormat = time.RFC1123 |
|
|
|
|
|
|
|
|
|
|
|
case "RFC1123Z": |
|
|
|
|
|
TimeFormat = time.RFC1123Z |
|
|
|
|
|
|
|
|
|
|
|
case "RFC3339": |
|
|
|
|
|
TimeFormat = time.RFC3339 |
|
|
|
|
|
|
|
|
|
|
|
case "RFC3339Nano": |
|
|
|
|
|
TimeFormat = time.RFC3339Nano |
|
|
|
|
|
|
|
|
|
|
|
case "Kitchen": |
|
|
|
|
|
TimeFormat = time.Kitchen |
|
|
|
|
|
|
|
|
|
|
|
case "Stamp": |
|
|
|
|
|
TimeFormat = time.Stamp |
|
|
|
|
|
|
|
|
|
|
|
case "StampMilli": |
|
|
|
|
|
TimeFormat = time.StampMilli |
|
|
|
|
|
|
|
|
|
|
|
case "StampMicro": |
|
|
|
|
|
TimeFormat = time.StampMicro |
|
|
|
|
|
|
|
|
|
|
|
case "StampNano": |
|
|
|
|
|
TimeFormat = time.StampNano |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
if err = os.MkdirAll(AttachmentPath, os.ModePerm); err != nil { |
|
|
if err = os.MkdirAll(AttachmentPath, os.ModePerm); err != nil { |
|
|
log.Fatal("Could not create directory %s: %s", AttachmentPath, err) |
|
|
log.Fatal("Could not create directory %s: %s", AttachmentPath, err) |
|
|
} |
|
|
} |
|
|