WIP add sourcegraph

This commit is contained in:
2026-02-03 19:14:07 -10:00
parent 65d93d819b
commit dfff777d04
19 changed files with 1367 additions and 3 deletions
+29
View File
@@ -0,0 +1,29 @@
// Copyright 2025 The Gitea Authors. All rights reserved.
// SPDX-License-Identifier: MIT
package sourcegraph
import (
"code.gitea.io/gitea/modules/log"
"code.gitea.io/gitea/modules/setting"
notify_service "code.gitea.io/gitea/services/notify"
)
// Init initializes the Sourcegraph service
func Init() error {
if !setting.Sourcegraph.Enabled {
return nil
}
defaultClient = NewClient()
notify_service.RegisterNotifier(NewNotifier())
log.Info("Sourcegraph integration enabled: %s", setting.Sourcegraph.URL)
return nil
}
// IsEnabled returns whether Sourcegraph integration is enabled
func IsEnabled() bool {
return setting.Sourcegraph.Enabled && defaultClient != nil
}