@@ -10,23 +10,32 @@ import (
1010 "code.gitea.io/gitea/modules/generate"
1111)
1212
13- // LFS represents the configuration for Git LFS
13+ // LFS represents the server-side configuration for Git LFS.
14+ // Ideally these options should be in a section like "[lfs_server]",
15+ // but they are in "[server]" section due to historical reasons.
16+ // Could be refactored in the future while keeping backwards compatibility.
1417var LFS = struct {
1518 StartServer bool `ini:"LFS_START_SERVER"`
1619 AllowPureSSH bool `ini:"LFS_ALLOW_PURE_SSH"`
1720 JWTSecretBytes []byte `ini:"-"`
1821 HTTPAuthExpiry time.Duration `ini:"LFS_HTTP_AUTH_EXPIRY"`
1922 MaxFileSize int64 `ini:"LFS_MAX_FILE_SIZE"`
2023 LocksPagingNum int `ini:"LFS_LOCKS_PAGING_NUM"`
24+ MaxBatchSize int `ini:"LFS_MAX_BATCH_SIZE"`
2125
2226 Storage * Storage
2327}{}
2428
29+ // LFSClient represents configuration for Gitea's LFS clients, for example: mirroring upstream Git LFS
30+ var LFSClient = struct {
31+ BatchSize int `ini:"BATCH_SIZE"`
32+ }{}
33+
2534func loadLFSFrom (rootCfg ConfigProvider ) error {
35+ mustMapSetting (rootCfg , "lfs_client" , & LFSClient )
36+
37+ mustMapSetting (rootCfg , "server" , & LFS )
2638 sec := rootCfg .Section ("server" )
27- if err := sec .MapTo (& LFS ); err != nil {
28- return fmt .Errorf ("failed to map LFS settings: %v" , err )
29- }
3039
3140 lfsSec , _ := rootCfg .GetSection ("lfs" )
3241
@@ -53,6 +62,10 @@ func loadLFSFrom(rootCfg ConfigProvider) error {
5362 LFS .LocksPagingNum = 50
5463 }
5564
65+ if LFSClient .BatchSize < 1 {
66+ LFSClient .BatchSize = 20
67+ }
68+
5669 LFS .HTTPAuthExpiry = sec .Key ("LFS_HTTP_AUTH_EXPIRY" ).MustDuration (24 * time .Hour )
5770
5871 if ! LFS .StartServer || ! InstallLock {
0 commit comments