Skip to content

Commit 08aab3f

Browse files
unknwonachilleas-k
authored andcommitted
conf: overhaul settings (#5953)
* Overhaul cache settings * Overhaul HTTP settings * conf: overhaul more settings * log: make LGTM happy * travis: upload report to Codecov * Add codecov.yml
1 parent fd76121 commit 08aab3f

26 files changed

+648
-626
lines changed

.travis.yml

+4-1
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,7 @@ before_install:
1414

1515
script:
1616
- go build -v -tags "pam"
17-
- go test -v -cover -race ./...
17+
- go test -v -race -coverprofile=coverage.txt -covermode=atomic ./...
18+
19+
after_success:
20+
- bash <(curl -s https://codecov.io/bash)

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ All notable changes to Gogs are documented in this file.
5252
- Configuration option `[repository] MIRROR_QUEUE_LENGTH`
5353
- Configuration option `[repository] PULL_REQUEST_QUEUE_LENGTH`
5454
- Configuration option `[session] ENABLE_SET_COOKIE`
55+
- Configuration option `[release.attachment] PATH`
5556

5657
---
5758

codecov.yml

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
comment:
2+
layout: 'diff, files'

conf/app.ini

+56-88
Original file line numberDiff line numberDiff line change
@@ -256,19 +256,63 @@ MAX_LIFE_TIME = 86400
256256
; The cookie name for CSRF token.
257257
CSRF_COOKIE_NAME = _csrf
258258

259-
; Attachment settings for releases
260-
[release.attachment]
261-
; Whether attachments are enabled. Defaults to `true`
259+
[cache]
260+
; The cache adapter, either "memory", "redis", or "memcache".
261+
ADAPTER = memory
262+
; For "memory" only, GC interval in seconds.
263+
INTERVAL = 60
264+
; For "redis" and "memcache", connection host address:
265+
; - redis: network=tcp,addr=:6379,password=macaron,db=0,pool_size=100,idle_timeout=180
266+
; - memcache: `127.0.0.1:11211`
267+
HOST =
268+
269+
[http]
270+
; The value for "Access-Control-Allow-Origin" header, default is not to present.
271+
ACCESS_CONTROL_ALLOW_ORIGIN =
272+
273+
[attachment]
274+
; Whether to enabled upload attachments in general.
262275
ENABLED = true
263-
; Path for attachments. Defaults to `data/attachments`
276+
; The path to store attachments on the file system.
264277
PATH = data/attachments
265-
; One or more allowed types, e.g. image/jpeg|image/png
278+
; File types that are allowed to be uploaded, e.g. "image/jpeg|image/png". Leave empty to allow any file type.
279+
ALLOWED_TYPES = image/jpeg|image/png
280+
; The maximum size of each file in MB.
281+
MAX_SIZE = 4
282+
; The maximum number of files per upload.
283+
MAX_FILES = 5
284+
285+
[release.attachment]
286+
; Whether to enabled upload attachments for releases.
287+
ENABLED = true
288+
; File types that are allowed to be uploaded, e.g. "image/jpeg|image/png". Leave empty to allow any file type.
266289
ALLOWED_TYPES = */*
267-
; Max size of each file. Defaults to 32MB
290+
; The maximum size of each file in MB.
268291
MAX_SIZE = 32
269-
; Max number of files per upload. Defaults to 10
292+
; The maximum number of files per upload.
270293
MAX_FILES = 10
271294

295+
[time]
296+
; Specifies the format for fully outputed dates.
297+
; Values should be one of the following:
298+
; ANSIC, UnixDate, RubyDate, RFC822, RFC822Z, RFC850, RFC1123, RFC1123Z, RFC3339, RFC3339Nano, Kitchen, Stamp, StampMilli, StampMicro and StampNano.
299+
; For more information about the format see http://golang.org/pkg/time/#pkg-constants.
300+
FORMAT = RFC1123
301+
302+
[picture]
303+
; The path to store user avatars on the file system.
304+
AVATAR_UPLOAD_PATH = data/avatars
305+
; The path to store repository avatars on the file system.
306+
REPOSITORY_AVATAR_UPLOAD_PATH = data/repo-avatars
307+
; Chinese users can use a custom avatar source, such as http://cn.gravatar.com/avatar/.
308+
GRAVATAR_SOURCE = gravatar
309+
; Whether to disable Gravatar, this value will be forced to be true in offline mode.
310+
DISABLE_GRAVATAR = false
311+
; Whether to enable federated avatar lookup uses DNS to discover avatar associated
312+
; with emails, see https://www.libravatar.org for details.
313+
; This value will be forced to be false in offline mode or when Gravatar is disbaled.
314+
ENABLE_FEDERATED_AVATAR = false
315+
272316
[markdown]
273317
; Enable hard line break extension
274318
ENABLE_HARD_LINE_BREAK = false
@@ -286,10 +330,6 @@ DASHES = true
286330
LATEX_DASHES = true
287331
ANGLED_QUOTES = true
288332

289-
[http]
290-
; Value for Access-Control-Allow-Origin header, default is not to present
291-
ACCESS_CONTROL_ALLOW_ORIGIN =
292-
293333
[admin]
294334
; Disable regular (non-admin) users to create organizations
295335
DISABLE_REGULAR_ORG_CREATION = false
@@ -306,50 +346,6 @@ SKIP_TLS_VERIFY = false
306346
; Number of history information in each page
307347
PAGING_NUM = 10
308348

309-
[cache]
310-
; Either "memory", "redis", or "memcache", default is "memory"
311-
ADAPTER = memory
312-
; For "memory" only, GC interval in seconds, default is 60
313-
INTERVAL = 60
314-
; For "redis" and "memcache", connection host address
315-
; redis: network=tcp,addr=:6379,password=macaron,db=0,pool_size=100,idle_timeout=180
316-
; memcache: `127.0.0.1:11211`
317-
HOST =
318-
319-
[picture]
320-
; Path to store user uploaded avatars
321-
AVATAR_UPLOAD_PATH = data/avatars
322-
; Path to store repository uploaded avatars
323-
REPOSITORY_AVATAR_UPLOAD_PATH = data/repo-avatars
324-
; Chinese users can choose "duoshuo"
325-
; or a custom avatar source, like: http://cn.gravatar.com/avatar/
326-
GRAVATAR_SOURCE = gravatar
327-
; This value will be forced to be true in offline mode.
328-
DISABLE_GRAVATAR = false
329-
; Federated avatar lookup uses DNS to discover avatar associated
330-
; with emails, see https://www.libravatar.org
331-
; This value will be forced to be false in offline mode or Gravatar is disbaled.
332-
ENABLE_FEDERATED_AVATAR = false
333-
334-
; Attachment settings for issues
335-
[attachment]
336-
; Whether attachments are enabled. Defaults to `true`
337-
ENABLED = true
338-
; Path for attachments. Defaults to `data/attachments`
339-
PATH = data/attachments
340-
; One or more allowed types, e.g. image/jpeg|image/png
341-
ALLOWED_TYPES = image/jpeg|image/png
342-
; Max size of each file. Defaults to 4MB
343-
MAX_SIZE = 4
344-
; Max number of files per upload. Defaults to 5
345-
MAX_FILES = 5
346-
347-
[time]
348-
; Specifies the format for fully outputed dates. Defaults to RFC1123
349-
; Special supported values are ANSIC, UnixDate, RubyDate, RFC822, RFC822Z, RFC850, RFC1123, RFC1123Z, RFC3339, RFC3339Nano, Kitchen, Stamp, StampMilli, StampMicro and StampNano
350-
; For more information about the format see http://golang.org/pkg/time/#pkg-constants
351-
FORMAT =
352-
353349
; General settings of loggers
354350
[log]
355351
ROOT_PATH =
@@ -458,7 +454,7 @@ PULL = 300
458454
GC = 60
459455

460456
[mirror]
461-
; Default interval in hours between each check
457+
; The default interval in hours for fetching updates.
462458
DEFAULT_INTERVAL = 8
463459

464460
[api]
@@ -505,6 +501,10 @@ ENABLE_BASIC_AUTH = false
505501
BASIC_AUTH_USERNAME =
506502
BASIC_AUTH_PASSWORD =
507503

504+
; Extension mapping to highlight class
505+
; e.g. .toml=ini
506+
[highlight.mapping]
507+
508508
[i18n]
509509
LANGS = en-US,zh-CN,zh-HK,zh-TW,de-DE,fr-FR,nl-NL,lv-LV,ru-RU,ja-JP,es-ES,pt-BR,pl-PL,bg-BG,it-IT,fi-FI,tr-TR,cs-CZ,sr-SP,sv-SE,ko-KR,gl-ES,uk-UA,en-GB,hu-HU,sk-SK,id-ID,fa-IR,vi-VN,pt-PT
510510
NAMES = English,简体中文,繁體中文(香港),繁體中文(臺灣),Deutsch,français,Nederlands,latviešu,русский,日本語,español,português do Brasil,polski,български,italiano,suomi,Türkçe,čeština,српски,svenska,한국어,galego,українська,English (United Kingdom),Magyar,Slovenčina,Indonesian,Persian,Vietnamese,Português
@@ -542,38 +542,6 @@ fa-IR = fa
542542
vi-VN = vi
543543
pt-PT = pt
544544

545-
[search]
546-
DO = false
547-
INDEX_URL = localhost/index
548-
SEACH_URL = localhost/search
549-
550-
[search]
551-
DO = false
552-
INDEX_URL = localhost/index
553-
SEACH_URL = localhost/search
554-
555-
[doi]
556-
DOI_URL = https://doi.gin.g-node.org/
557-
; AES key (eg. openssl enc -aes-128-cbc -k secret -P -md sha1)
558-
DOI_KEY = WONTWORK
559-
DOI_BASE = 123454/789.gty
560-
561-
[dav]
562-
; Is webdav on
563-
ON = false
564-
; is login required for webdav
565-
LOGGED = true
566-
; authorisation REALM
567-
AUTH_REALM = localhost
568-
569-
[cliconfig]
570-
RSA_HOST_KEY = notset
571-
572-
573-
; Extension mapping to highlight class
574-
; e.g. .toml=ini
575-
[highlight.mapping]
576-
577545
[other]
578546
SHOW_FOOTER_BRANDING = false
579547
; Show time of template execution in the footer

conf/locale/locale_en-US.ini

+7-8
Original file line numberDiff line numberDiff line change
@@ -1293,11 +1293,15 @@ config.session.gc_interval = GC interval
12931293
config.session.max_life_time = Max life time
12941294
config.session.csrf_cookie_name = CSRF cookie
12951295
1296-
config.log_file_root_path = Log File Root Path
1296+
config.cache_config = Cache configuration
1297+
config.cache.adapter = Adapter
1298+
config.cache.interval = GC interval
1299+
config.cache.host = Host
12971300
1298-
config.http_config = HTTP Configuration
1299-
config.http_access_control_allow_origin = Access Control Allow Origin
1301+
config.http_config = HTTP configuration
1302+
config.http.access_control_allow_origin = Access control allow origin
13001303
1304+
config.log_file_root_path = Log File Root Path
13011305
13021306
config.webhook_config = Webhook Configuration
13031307
config.queue_length = Queue Length
@@ -1307,11 +1311,6 @@ config.skip_tls_verify = Skip TLS Verify
13071311
config.oauth_config = OAuth Configuration
13081312
config.oauth_enabled = Enabled
13091313
1310-
config.cache_config = Cache Configuration
1311-
config.cache_adapter = Cache Adapter
1312-
config.cache_interval = Cache Interval
1313-
config.cache_conn = Cache Connection
1314-
13151314
config.picture_config = Picture Configuration
13161315
config.picture_service = Picture Service
13171316
config.disable_gravatar = Disable Gravatar

internal/assets/conf/conf_gen.go

+8-8
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)