30 lines
686 B
Go
30 lines
686 B
Go
// 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
|
|
}
|