Skip to content

Commit 761db4d

Browse files
author
Gusted
authored
Disable federation by default (#20045) (#20046)
* Disable federation by default (#20045) - Backport #20045 - A Gitea instance should choose whetever they want to federate(as once it has more features also brings extra costs/moderation/unexpected behavior) with other AP/ForgeFed software. * Fix tests
1 parent 2dc6571 commit 761db4d

File tree

4 files changed

+12
-9
lines changed

4 files changed

+12
-9
lines changed

custom/conf/app.example.ini

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2247,10 +2247,10 @@ PATH =
22472247
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
22482248
;;
22492249
;; Enable/Disable federation capabilities
2250-
; ENABLED = true
2250+
;ENABLED = false
22512251
;;
22522252
;; Enable/Disable user statistics for nodeinfo if federation is enabled
2253-
; SHARE_USER_STATISTICS = true
2253+
;SHARE_USER_STATISTICS = true
22542254

22552255
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
22562256
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

docs/content/doc/advanced/config-cheat-sheet.en-us.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1088,7 +1088,7 @@ Task queue configuration has been moved to `queue.task`. However, the below conf
10881088

10891089
## Federation (`federation`)
10901090

1091-
- `ENABLED`: **true**: Enable/Disable federation capabilities
1091+
- `ENABLED`: **false**: Enable/Disable federation capabilities
10921092
- `SHARE_USER_STATISTICS`: **true**: Enable/Disable user statistics for nodeinfo if federation is enabled
10931093

10941094
## Packages (`packages`)

integrations/api_nodeinfo_test.go

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,17 +11,20 @@ import (
1111

1212
"code.gitea.io/gitea/modules/setting"
1313
api "code.gitea.io/gitea/modules/structs"
14+
"code.gitea.io/gitea/routers"
1415

1516
"github.com/stretchr/testify/assert"
1617
)
1718

1819
func TestNodeinfo(t *testing.T) {
19-
onGiteaRun(t, func(*testing.T, *url.URL) {
20-
setting.Federation.Enabled = true
21-
defer func() {
22-
setting.Federation.Enabled = false
23-
}()
20+
setting.Federation.Enabled = true
21+
c = routers.NormalRoutes()
22+
defer func() {
23+
setting.Federation.Enabled = false
24+
c = routers.NormalRoutes()
25+
}()
2426

27+
onGiteaRun(t, func(*testing.T, *url.URL) {
2528
req := NewRequestf(t, "GET", "/api/v1/nodeinfo")
2629
resp := MakeRequest(t, req, http.StatusOK)
2730
var nodeinfo api.NodeInfo

modules/setting/federation.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ var (
1212
Enabled bool
1313
ShareUserStatistics bool
1414
}{
15-
Enabled: true,
15+
Enabled: false,
1616
ShareUserStatistics: true,
1717
}
1818
)

0 commit comments

Comments
 (0)