WIP add sourcegraph
This commit is contained in:
@@ -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
|
||||
}
|
||||
Reference in New Issue
Block a user