aboutsummaryrefslogtreecommitdiff
path: root/modules/setting
diff options
context:
space:
mode:
Diffstat (limited to 'modules/setting')
-rw-r--r--modules/setting/setting.go23
1 files changed, 19 insertions, 4 deletions
diff --git a/modules/setting/setting.go b/modules/setting/setting.go
index 2f64511a..73ec8ddd 100644
--- a/modules/setting/setting.go
+++ b/modules/setting/setting.go
@@ -53,6 +53,10 @@ var (
CookieUserName string
CookieRememberName string
+ // Webhook settings.
+ WebhookTaskInterval int
+ WebhookDeliverTimeout int
+
// Repository settings.
RepoRootPath string
ScriptType string
@@ -86,8 +90,7 @@ var (
RunUser string
)
-// WorkDir returns absolute path of work directory.
-func WorkDir() (string, error) {
+func ExecPath() (string, error) {
file, err := exec.LookPath(os.Args[0])
if err != nil {
return "", err
@@ -96,7 +99,13 @@ func WorkDir() (string, error) {
if err != nil {
return "", err
}
- return path.Dir(strings.Replace(p, "\\", "/", -1)), nil
+ return p, nil
+}
+
+// WorkDir returns absolute path of work directory.
+func WorkDir() (string, error) {
+ execPath, err := ExecPath()
+ return path.Dir(strings.Replace(execPath, "\\", "/", -1)), err
}
// NewConfigContext initializes configuration context.
@@ -187,9 +196,9 @@ var Service struct {
RequireSignInView bool
EnableCacheAvatar bool
NotifyMail bool
+ LdapAuth bool
ActiveCodeLives int
ResetPwdCodeLives int
- LdapAuth bool
}
func newService() {
@@ -390,6 +399,11 @@ func newNotifyMailService() {
log.Info("Notify Mail Service Enabled")
}
+func newWebhookService() {
+ WebhookTaskInterval = Cfg.MustInt("webhook", "TASK_INTERVAL", 1)
+ WebhookDeliverTimeout = Cfg.MustInt("webhook", "DELIVER_TIMEOUT", 5)
+}
+
func NewServices() {
newService()
newLogService()
@@ -398,4 +412,5 @@ func NewServices() {
newMailService()
newRegisterMailService()
newNotifyMailService()
+ newWebhookService()
}