@@ -104,16 +104,21 @@ var (
104
104
UseTiDB bool
105
105
106
106
// Webhook settings
107
- Webhook struct {
107
+ Webhook = struct {
108
108
QueueLength int
109
109
DeliverTimeout int
110
110
SkipTLSVerify bool
111
111
Types []string
112
112
PagingNum int
113
+ }{
114
+ QueueLength : 1000 ,
115
+ DeliverTimeout : 5 ,
116
+ SkipTLSVerify : false ,
117
+ PagingNum : 10 ,
113
118
}
114
119
115
120
// Repository settings
116
- Repository struct {
121
+ Repository = struct {
117
122
AnsiCharset string
118
123
ForcePrivate bool
119
124
MaxCreationLimit int
@@ -136,12 +141,44 @@ var (
136
141
FileMaxSize int64
137
142
MaxFiles int
138
143
} `ini:"-"`
144
+ }{
145
+ AnsiCharset : "" ,
146
+ ForcePrivate : false ,
147
+ MaxCreationLimit : - 1 ,
148
+ MirrorQueueLength : 1000 ,
149
+ PullRequestQueueLength : 1000 ,
150
+ PreferredLicenses : []string {"Apache License 2.0,MIT License" },
151
+ DisableHTTPGit : false ,
152
+
153
+ // Repository editor settings
154
+ Editor : struct {
155
+ LineWrapExtensions []string
156
+ PreviewableFileModes []string
157
+ }{
158
+ LineWrapExtensions : strings .Split (".txt,.md,.markdown,.mdown,.mkd," , "," ),
159
+ PreviewableFileModes : []string {"markdown" },
160
+ },
161
+
162
+ // Repository upload settings
163
+ Upload : struct {
164
+ Enabled bool
165
+ TempPath string
166
+ AllowedTypes []string `delim:"|"`
167
+ FileMaxSize int64
168
+ MaxFiles int
169
+ }{
170
+ Enabled : true ,
171
+ TempPath : "data/tmp/uploads" ,
172
+ AllowedTypes : []string {},
173
+ FileMaxSize : 3 ,
174
+ MaxFiles : 5 ,
175
+ },
139
176
}
140
177
RepoRootPath string
141
- ScriptType string
178
+ ScriptType = "bash"
142
179
143
180
// UI settings
144
- UI struct {
181
+ UI = struct {
145
182
ExplorePagingNum int
146
183
IssuePagingNum int
147
184
FeedMaxCommitNum int
@@ -157,13 +194,38 @@ var (
157
194
User struct {
158
195
RepoPagingNum int
159
196
} `ini:"ui.user"`
197
+ }{
198
+ ExplorePagingNum : 20 ,
199
+ IssuePagingNum : 10 ,
200
+ FeedMaxCommitNum : 5 ,
201
+ ThemeColorMetaTag : `#6cc644` ,
202
+ MaxDisplayFileSize : 8388608 ,
203
+ Admin : struct {
204
+ UserPagingNum int
205
+ RepoPagingNum int
206
+ NoticePagingNum int
207
+ OrgPagingNum int
208
+ }{
209
+ UserPagingNum : 50 ,
210
+ RepoPagingNum : 50 ,
211
+ NoticePagingNum : 25 ,
212
+ OrgPagingNum : 50 ,
213
+ },
214
+ User : struct {
215
+ RepoPagingNum int
216
+ }{
217
+ RepoPagingNum : 15 ,
218
+ },
160
219
}
161
220
162
221
// Markdown sttings
163
- Markdown struct {
222
+ Markdown = struct {
164
223
EnableHardLineBreak bool
165
224
CustomURLSchemes []string `ini:"CUSTOM_URL_SCHEMES"`
166
225
FileExtensions []string
226
+ }{
227
+ EnableHardLineBreak : false ,
228
+ FileExtensions : strings .Split (".md,.markdown,.mdown,.mkd" , "," ),
167
229
}
168
230
169
231
// Picture settings
@@ -198,7 +260,7 @@ var (
198
260
CSRFCookieName = "_csrf"
199
261
200
262
// Cron tasks
201
- Cron struct {
263
+ Cron = struct {
202
264
UpdateMirror struct {
203
265
Enabled bool
204
266
RunAtStart bool
@@ -216,10 +278,37 @@ var (
216
278
RunAtStart bool
217
279
Schedule string
218
280
} `ini:"cron.check_repo_stats"`
281
+ }{
282
+ UpdateMirror : struct {
283
+ Enabled bool
284
+ RunAtStart bool
285
+ Schedule string
286
+ }{
287
+ Schedule : "@every 10m" ,
288
+ },
289
+ RepoHealthCheck : struct {
290
+ Enabled bool
291
+ RunAtStart bool
292
+ Schedule string
293
+ Timeout time.Duration
294
+ Args []string `delim:" "`
295
+ }{
296
+ Schedule : "@every 24h" ,
297
+ Timeout : 60 * time .Second ,
298
+ Args : []string {},
299
+ },
300
+ CheckRepoStats : struct {
301
+ Enabled bool
302
+ RunAtStart bool
303
+ Schedule string
304
+ }{
305
+ RunAtStart : true ,
306
+ Schedule : "@every 24h" ,
307
+ },
219
308
}
220
309
221
310
// Git settings
222
- Git struct {
311
+ Git = struct {
223
312
DisableDiffHighlight bool
224
313
MaxGitDiffLines int
225
314
MaxGitDiffLineCharacters int
@@ -232,16 +321,39 @@ var (
232
321
Pull int
233
322
GC int `ini:"GC"`
234
323
} `ini:"git.timeout"`
324
+ }{
325
+ DisableDiffHighlight : false ,
326
+ MaxGitDiffLines : 1000 ,
327
+ MaxGitDiffLineCharacters : 500 ,
328
+ MaxGitDiffFiles : 100 ,
329
+ GCArgs : []string {},
330
+ Timeout : struct {
331
+ Migrate int
332
+ Mirror int
333
+ Clone int
334
+ Pull int
335
+ GC int `ini:"GC"`
336
+ }{
337
+ Migrate : 600 ,
338
+ Mirror : 300 ,
339
+ Clone : 300 ,
340
+ Pull : 300 ,
341
+ GC : 60 ,
342
+ },
235
343
}
236
344
237
345
// Mirror settings
238
- Mirror struct {
346
+ Mirror = struct {
239
347
DefaultInterval int
348
+ }{
349
+ DefaultInterval : 8 ,
240
350
}
241
351
242
352
// API settings
243
- API struct {
353
+ API = struct {
244
354
MaxResponseItems int
355
+ }{
356
+ MaxResponseItems : 50 ,
245
357
}
246
358
247
359
// I18n settings
@@ -470,11 +582,11 @@ please consider changing to GITEA_CUSTOM`)
470
582
}
471
583
472
584
sec = Cfg .Section ("security" )
473
- InstallLock = sec .Key ("INSTALL_LOCK" ).MustBool ()
474
- SecretKey = sec .Key ("SECRET_KEY" ).String ( )
475
- LogInRememberDays = sec .Key ("LOGIN_REMEMBER_DAYS" ).MustInt ()
476
- CookieUserName = sec .Key ("COOKIE_USERNAME" ).String ( )
477
- CookieRememberName = sec .Key ("COOKIE_REMEMBER_NAME" ).String ( )
585
+ InstallLock = sec .Key ("INSTALL_LOCK" ).MustBool (false )
586
+ SecretKey = sec .Key ("SECRET_KEY" ).MustString ( "!#@FDEWREWR&*(" )
587
+ LogInRememberDays = sec .Key ("LOGIN_REMEMBER_DAYS" ).MustInt (7 )
588
+ CookieUserName = sec .Key ("COOKIE_USERNAME" ).MustString ( "gitea_awesome" )
589
+ CookieRememberName = sec .Key ("COOKIE_REMEMBER_NAME" ).MustString ( "gitea_incredible" )
478
590
ReverseProxyAuthUser = sec .Key ("REVERSE_PROXY_AUTHENTICATION_USER" ).MustString ("X-WEBAUTH-USER" )
479
591
480
592
sec = Cfg .Section ("attachment" )
@@ -597,21 +709,17 @@ please consider changing to GITEA_CUSTOM`)
597
709
598
710
Langs = Cfg .Section ("i18n" ).Key ("LANGS" ).Strings ("," )
599
711
if len (Langs ) == 0 {
600
- Langs = []string {
601
- "en-US" ,
602
- }
712
+ Langs = defaultLangs
603
713
}
604
714
Names = Cfg .Section ("i18n" ).Key ("NAMES" ).Strings ("," )
605
715
if len (Names ) == 0 {
606
- Names = []string {
607
- "English" ,
608
- }
716
+ Names = defaultLangNames
609
717
}
610
718
dateLangs = Cfg .Section ("i18n.datelang" ).KeysHash ()
611
719
612
- ShowFooterBranding = Cfg .Section ("other" ).Key ("SHOW_FOOTER_BRANDING" ).MustBool ()
613
- ShowFooterVersion = Cfg .Section ("other" ).Key ("SHOW_FOOTER_VERSION" ).MustBool ()
614
- ShowFooterTemplateLoadTime = Cfg .Section ("other" ).Key ("SHOW_FOOTER_TEMPLATE_LOAD_TIME" ).MustBool ()
720
+ ShowFooterBranding = Cfg .Section ("other" ).Key ("SHOW_FOOTER_BRANDING" ).MustBool (false )
721
+ ShowFooterVersion = Cfg .Section ("other" ).Key ("SHOW_FOOTER_VERSION" ).MustBool (true )
722
+ ShowFooterTemplateLoadTime = Cfg .Section ("other" ).Key ("SHOW_FOOTER_TEMPLATE_LOAD_TIME" ).MustBool (true )
615
723
616
724
HasRobotsTxt = com .IsFile (path .Join (CustomPath , "robots.txt" ))
617
725
}
@@ -738,7 +846,7 @@ func newSessionService() {
738
846
SessionConfig .ProviderConfig = strings .Trim (Cfg .Section ("session" ).Key ("PROVIDER_CONFIG" ).String (), "\" " )
739
847
SessionConfig .CookieName = Cfg .Section ("session" ).Key ("COOKIE_NAME" ).MustString ("i_like_gogits" )
740
848
SessionConfig .CookiePath = AppSubURL
741
- SessionConfig .Secure = Cfg .Section ("session" ).Key ("COOKIE_SECURE" ).MustBool ()
849
+ SessionConfig .Secure = Cfg .Section ("session" ).Key ("COOKIE_SECURE" ).MustBool (false )
742
850
SessionConfig .Gclifetime = Cfg .Section ("session" ).Key ("GC_INTERVAL_TIME" ).MustInt64 (86400 )
743
851
SessionConfig .Maxlifetime = Cfg .Section ("session" ).Key ("SESSION_LIFE_TIME" ).MustInt64 (86400 )
744
852
0 commit comments