Skip to content

Commit f769015

Browse files
authored
Merge branch 'master' into fix-7908-4721
2 parents 094864f + f83db07 commit f769015

File tree

433 files changed

+15287
-13555
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

433 files changed

+15287
-13555
lines changed

.golangci.yml

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -86,15 +86,6 @@ issues:
8686
- path: models/issue_comment_list.go
8787
linters:
8888
- dupl
89-
# "Destroy" is misspelled in github.com/go-macaron/session/session.go:213 so it's not our responsability to fix it
90-
- path: modules/session/virtual.go
91-
linters:
92-
- misspell
93-
text: '`Destory` is a misspelling of `Destroy`'
94-
- path: modules/session/memory.go
95-
linters:
96-
- misspell
97-
text: '`Destory` is a misspelling of `Destroy`'
9889
- linters:
9990
- misspell
10091
text: '`Unknwon` is a misspelling of `Unknown`'

cmd/cmd.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ func initDB() error {
3838

3939
func initDBDisableConsole(disableConsole bool) error {
4040
setting.NewContext()
41-
models.LoadConfigs()
41+
setting.InitDBConfig()
4242

4343
setting.NewXORMLogService(disableConsole)
4444
if err := models.SetEngine(); err != nil {

cmd/convert.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,9 @@ func runConvert(ctx *cli.Context) error {
3131
log.Trace("AppWorkPath: %s", setting.AppWorkPath)
3232
log.Trace("Custom path: %s", setting.CustomPath)
3333
log.Trace("Log path: %s", setting.LogRootPath)
34-
models.LoadConfigs()
34+
setting.InitDBConfig()
3535

36-
if models.DbCfg.Type != "mysql" {
36+
if !setting.Database.UseMySQL {
3737
fmt.Println("This command can only be used with a MySQL database")
3838
return nil
3939
}

cmd/dump.go

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ import (
1717
"code.gitea.io/gitea/models"
1818
"code.gitea.io/gitea/modules/setting"
1919

20-
"github.com/Unknwon/cae/zip"
21-
"github.com/Unknwon/com"
20+
"github.com/unknwon/cae/zip"
21+
"github.com/unknwon/com"
2222
"github.com/urfave/cli"
2323
)
2424

@@ -58,7 +58,6 @@ It can be used for backup and capture Gitea server image to send to maintainer`,
5858
func runDump(ctx *cli.Context) error {
5959
setting.NewContext()
6060
setting.NewServices() // cannot access session settings otherwise
61-
models.LoadConfigs()
6261

6362
err := models.SetEngine()
6463
if err != nil {
@@ -104,8 +103,8 @@ func runDump(ctx *cli.Context) error {
104103
}
105104

106105
targetDBType := ctx.String("database")
107-
if len(targetDBType) > 0 && targetDBType != models.DbCfg.Type {
108-
log.Printf("Dumping database %s => %s...", models.DbCfg.Type, targetDBType)
106+
if len(targetDBType) > 0 && targetDBType != setting.Database.Type {
107+
log.Printf("Dumping database %s => %s...", setting.Database.Type, targetDBType)
109108
} else {
110109
log.Printf("Dumping database...")
111110
}

cmd/migrate.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ func runMigrate(ctx *cli.Context) error {
3030
log.Trace("AppWorkPath: %s", setting.AppWorkPath)
3131
log.Trace("Custom path: %s", setting.CustomPath)
3232
log.Trace("Log path: %s", setting.LogRootPath)
33-
models.LoadConfigs()
33+
setting.InitDBConfig()
3434

3535
if err := models.NewEngine(migrations.Migrate); err != nil {
3636
log.Fatal("Failed to initialize ORM engine: %v", err)

cmd/serv.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ import (
2222
"code.gitea.io/gitea/modules/private"
2323
"code.gitea.io/gitea/modules/setting"
2424

25-
"github.com/Unknwon/com"
2625
"github.com/dgrijalva/jwt-go"
26+
"github.com/unknwon/com"
2727
"github.com/urfave/cli"
2828
)
2929

cmd/web.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ import (
1818
"code.gitea.io/gitea/routers"
1919
"code.gitea.io/gitea/routers/routes"
2020

21-
"github.com/Unknwon/com"
2221
context2 "github.com/gorilla/context"
22+
"github.com/unknwon/com"
2323
"github.com/urfave/cli"
2424
"golang.org/x/crypto/acme/autocert"
2525
ini "gopkg.in/ini.v1"

contrib/pr/checkout.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,9 @@ import (
2727
"code.gitea.io/gitea/routers"
2828
"code.gitea.io/gitea/routers/routes"
2929

30-
"github.com/Unknwon/com"
3130
"github.com/go-xorm/xorm"
3231
context2 "github.com/gorilla/context"
32+
"github.com/unknwon/com"
3333
"gopkg.in/src-d/go-git.v4"
3434
"gopkg.in/src-d/go-git.v4/config"
3535
"gopkg.in/src-d/go-git.v4/plumbing"
@@ -79,16 +79,16 @@ func runPR() {
7979
setting.CheckLFSVersion()
8080
//models.LoadConfigs()
8181
/*
82-
models.DbCfg.Type = "sqlite3"
83-
models.DbCfg.Path = ":memory:"
84-
models.DbCfg.Timeout = 500
82+
setting.Database.Type = "sqlite3"
83+
setting.Database.Path = ":memory:"
84+
setting.Database.Timeout = 500
8585
*/
8686
db := setting.Cfg.Section("database")
8787
db.NewKey("DB_TYPE", "sqlite3")
8888
db.NewKey("PATH", ":memory:")
89-
setting.LogSQL = true
90-
models.LoadConfigs()
89+
9190
routers.NewServices()
91+
setting.Database.LogSQL = true
9292
//x, err = xorm.NewEngine("sqlite3", "file::memory:?cache=shared")
9393

9494
var helper testfixtures.Helper = &testfixtures.SQLite{}

custom/conf/app.ini.sample

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -275,6 +275,10 @@ LOG_SQL = true
275275
DB_RETRIES = 10
276276
; Backoff time per DB retry (time.Duration)
277277
DB_RETRY_BACKOFF = 3s
278+
; Max idle database connections on connnection pool, default is 0
279+
MAX_IDLE_CONNS = 0
280+
; Database connection max life time, default is 3s
281+
CONN_MAX_LIFETIME = 3s
278282

279283
[indexer]
280284
; Issue indexer type, currently support: bleve or db, default is bleve

docker/root/etc/s6/gitea/setup

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ if [ ! -f ${GITEA_CUSTOM}/conf/app.ini ]; then
3131
ROOT_URL=${ROOT_URL:-""} \
3232
DISABLE_SSH=${DISABLE_SSH:-"false"} \
3333
SSH_PORT=${SSH_PORT:-"22"} \
34+
SSH_LISTEN_PORT=${SSH_LISTEN_PORT:-"${SSH_PORT}"} \
3435
LFS_START_SERVER=${LFS_START_SERVER:-"false"} \
3536
DB_TYPE=${DB_TYPE:-"sqlite3"} \
3637
DB_HOST=${DB_HOST:-"localhost:3306"} \

docker/root/etc/templates/app.ini

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ HTTP_PORT = $HTTP_PORT
1717
ROOT_URL = $ROOT_URL
1818
DISABLE_SSH = $DISABLE_SSH
1919
SSH_PORT = $SSH_PORT
20+
SSH_LISTEN_PORT = $SSH_LISTEN_PORT
2021
LFS_START_SERVER = $LFS_START_SERVER
2122
LFS_CONTENT_PATH = /data/git/lfs
2223

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,8 @@ Values containing `#` or `;` must be quoted using `` ` `` or `"""`.
166166
- `LOG_SQL`: **true**: Log the executed SQL.
167167
- `DB_RETRIES`: **10**: How many ORM init / DB connect attempts allowed.
168168
- `DB_RETRY_BACKOFF`: **3s**: time.Duration to wait before trying another ORM init / DB connect attempt, if failure occured.
169+
- `MAX_IDLE_CONNS` **0**: Max idle database connections on connnection pool, default is 0
170+
- `CONN_MAX_LIFETIME` **3s**: Database connection max lifetime
169171

170172
## Indexer (`indexer`)
171173

docs/content/doc/advanced/config-cheat-sheet.zh-cn.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,8 @@ menu:
8282
- `CHARSET`: **utf8**: 仅当数据库为 MySQL 时有效, 可以为 "utf8" 或 "utf8mb4"。注意:如果使用 "utf8mb4",你的 MySQL InnoDB 版本必须在 5.6 以上。
8383
- `PATH`: Tidb 或者 SQLite3 数据文件存放路径。
8484
- `LOG_SQL`: **true**: 显示生成的SQL,默认为真。
85+
- `MAX_IDLE_CONNS` **0**: 最大空闲数据库连接
86+
- `CONN_MAX_LIFETIME` **3s**: 数据库连接最大存活时间
8587

8688
## Indexer (`indexer`)
8789

docs/content/doc/installation/with-docker.en-us.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -245,6 +245,7 @@ You can configure some of Gitea's settings via environment variables:
245245
* `RUN_MODE`: **dev**: For performance and other purposes, change this to `prod` when deployed to a production environment.
246246
* `SSH_DOMAIN`: **localhost**: Domain name of this server, used for the displayed clone URL in Gitea's UI.
247247
* `SSH_PORT`: **22**: SSH port displayed in clone URL.
248+
* `SSH_LISTEN_PORT`: **%(SSH\_PORT)s**: Port for the built-in SSH server.
248249
* `DISABLE_SSH`: **false**: Disable SSH feature when it's not available.
249250
* `HTTP_PORT`: **3000**: HTTP listen port.
250251
* `ROOT_URL`: **""**: Overwrite the automatically generated public URL. This is useful if the internal and the external URL don't match (e.g. in Docker).

go.mod

Lines changed: 17 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -3,31 +3,32 @@ module code.gitea.io/gitea
33
go 1.12
44

55
require (
6+
gitea.com/macaron/binding v0.0.0-20190822013154-a5f53841ed2b
7+
gitea.com/macaron/cache v0.0.0-20190822004001-a6e7fee4ee76
8+
gitea.com/macaron/captcha v0.0.0-20190822015246-daa973478bae
9+
gitea.com/macaron/cors v0.0.0-20190821152825-7dcef4a17175
10+
gitea.com/macaron/csrf v0.0.0-20190822024205-3dc5a4474439
11+
gitea.com/macaron/i18n v0.0.0-20190822004228-474e714e2223
12+
gitea.com/macaron/inject v0.0.0-20190805023432-d4c86e31027a
13+
gitea.com/macaron/macaron v1.3.3-0.20190821202302-9646c0587edb
14+
gitea.com/macaron/session v0.0.0-20190821211443-122c47c5f705
15+
gitea.com/macaron/toolbox v0.0.0-20190822013122-05ff0fc766b7
616
github.com/PuerkitoBio/goquery v0.0.0-20170324135448-ed7d758e9a34
717
github.com/RoaringBitmap/roaring v0.4.7 // indirect
8-
github.com/Unknwon/cae v0.0.0-20160715032808-c6aac99ea2ca
9-
github.com/Unknwon/com v0.0.0-20190321035513-0fed4efef755
10-
github.com/Unknwon/i18n v0.0.0-20171114194641-b64d33658966
11-
github.com/Unknwon/paginater v0.0.0-20151104151617-7748a72e0141
1218
github.com/andybalholm/cascadia v0.0.0-20161224141413-349dd0209470 // indirect
1319
github.com/bgentry/speakeasy v0.1.0 // indirect
1420
github.com/blevesearch/bleve v0.0.0-20190214220507-05d86ea8f6e3
1521
github.com/blevesearch/blevex v0.0.0-20180227211930-4b158bb555a3 // indirect
1622
github.com/blevesearch/go-porterstemmer v0.0.0-20141230013033-23a2c8e5cf1f // indirect
1723
github.com/blevesearch/segment v0.0.0-20160105220820-db70c57796cc // indirect
1824
github.com/boombuler/barcode v0.0.0-20161226211916-fe0f26ff6d26 // indirect
19-
github.com/bradfitz/gomemcache v0.0.0-20160117192205-fb1f79c6b65a // indirect
2025
github.com/chaseadamsio/goorgeous v0.0.0-20170901132237-098da33fde5f
21-
github.com/couchbase/gomemcached v0.0.0-20181122193126-5125a94a666c // indirect
22-
github.com/couchbase/goutils v0.0.0-20180530154633-e865a1461c8a // indirect
2326
github.com/couchbase/vellum v0.0.0-20190111184608-e91b68ff3efe // indirect
24-
github.com/couchbaselabs/go-couchbase v0.0.0-20190117181324-d904413d884d // indirect
2527
github.com/cznic/b v0.0.0-20181122101859-a26611c4d92d // indirect
2628
github.com/cznic/mathutil v0.0.0-20181122101859-297441e03548 // indirect
2729
github.com/cznic/strutil v0.0.0-20181122101858-275e90344537 // indirect
2830
github.com/denisenkom/go-mssqldb v0.0.0-20190724012636-11b2859924c1
2931
github.com/dgrijalva/jwt-go v3.2.0+incompatible
30-
github.com/edsrzf/mmap-go v0.0.0-20170320065105-0bce6a688712 // indirect
3132
github.com/emirpasic/gods v1.12.0
3233
github.com/etcd-io/bbolt v1.3.2 // indirect
3334
github.com/ethantkoenig/rupture v0.0.0-20180203182544-0a76f03a811a
@@ -42,15 +43,6 @@ require (
4243
github.com/gliderlabs/ssh v0.2.2
4344
github.com/glycerine/go-unsnap-stream v0.0.0-20180323001048-9f0cb55181dd // indirect
4445
github.com/glycerine/goconvey v0.0.0-20190315024820-982ee783a72e // indirect
45-
github.com/go-macaron/binding v0.0.0-20160711225916-9440f336b443
46-
github.com/go-macaron/cache v0.0.0-20151013081102-561735312776
47-
github.com/go-macaron/captcha v0.0.0-20190710000913-8dc5911259df
48-
github.com/go-macaron/cors v0.0.0-20190309005821-6fd6a9bfe14e9
49-
github.com/go-macaron/csrf v0.0.0-20190131233648-3751b136073c
50-
github.com/go-macaron/i18n v0.0.0-20190131234336-56731837a73b
51-
github.com/go-macaron/inject v0.0.0-20160627170012-d8a0b8677191
52-
github.com/go-macaron/session v0.0.0-20190131233854-0a0a789bf193
53-
github.com/go-macaron/toolbox v0.0.0-20180818072302-a77f45a7ce90
5446
github.com/go-redis/redis v6.15.2+incompatible
5547
github.com/go-sql-driver/mysql v1.4.1
5648
github.com/go-xorm/xorm v0.7.4
@@ -69,15 +61,13 @@ require (
6961
github.com/klauspost/cpuid v0.0.0-20160302075316-09cded8978dc // indirect
7062
github.com/klauspost/crc32 v0.0.0-20161016154125-cb6bfca970f6 // indirect
7163
github.com/lafriks/xormstore v1.1.0
72-
github.com/lib/pq v1.1.0
64+
github.com/lib/pq v1.2.0
7365
github.com/lunny/dingtalk_webhook v0.0.0-20171025031554-e3534c89ef96
7466
github.com/lunny/levelqueue v0.0.0-20190217115915-02b525a4418e
75-
github.com/lunny/log v0.0.0-20160921050905-7887c61bf0de // indirect
76-
github.com/lunny/nodb v0.0.0-20160621015157-fc1ef06ad4af // indirect
7767
github.com/markbates/goth v1.49.0
7868
github.com/mattn/go-isatty v0.0.7
7969
github.com/mattn/go-oci8 v0.0.0-20190320171441-14ba190cf52d // indirect
80-
github.com/mattn/go-sqlite3 v1.10.0
70+
github.com/mattn/go-sqlite3 v1.11.0
8171
github.com/mcuadros/go-version v0.0.0-20190308113854-92cdf37c5b75
8272
github.com/microcosm-cc/bluemonday v0.0.0-20161012083705-f77f16ffc87a
8373
github.com/mschoch/smat v0.0.0-20160514031455-90eadee771ae // indirect
@@ -95,13 +85,15 @@ require (
9585
github.com/shurcooL/httpfs v0.0.0-20190527155220-6a4d4a70508b // indirect
9686
github.com/shurcooL/sanitized_anchor_name v0.0.0-20160918041101-1dba4b3954bc // indirect
9787
github.com/shurcooL/vfsgen v0.0.0-20181202132449-6a9ea43bcacd
98-
github.com/siddontang/go-snappy v0.0.0-20140704025258-d8f7bb82a96d // indirect
99-
github.com/smartystreets/goconvey v0.0.0-20190306220146-200a235640ff // indirect
10088
github.com/steveyen/gtreap v0.0.0-20150807155958-0abe01ef9be2 // indirect
10189
github.com/stretchr/testify v1.3.0
10290
github.com/tecbot/gorocksdb v0.0.0-20181010114359-8752a9433481 // indirect
10391
github.com/tinylib/msgp v0.0.0-20180516164116-c8cf64dff200 // indirect
10492
github.com/tstranex/u2f v1.0.0
93+
github.com/unknwon/cae v0.0.0-20190822084630-55a0b64484a1
94+
github.com/unknwon/com v0.0.0-20190804042917-757f69c95f3e
95+
github.com/unknwon/i18n v0.0.0-20190805065654-5c6446a380b6
96+
github.com/unknwon/paginater v0.0.0-20151104151617-7748a72e0141
10597
github.com/urfave/cli v1.20.0
10698
github.com/willf/bitset v0.0.0-20180426185212-8ce1146b8621 // indirect
10799
github.com/yohcop/openid-go v0.0.0-20160914080427-2c050d2dae53
@@ -114,13 +106,10 @@ require (
114106
golang.org/x/tools v0.0.0-20190731214159-1e85ed8060aa // indirect
115107
gopkg.in/alexcesaro/quotedprintable.v3 v3.0.0-20150716171945-2caba252f4dc // indirect
116108
gopkg.in/asn1-ber.v1 v1.0.0-20150924051756-4e86f4367175 // indirect
117-
gopkg.in/bufio.v1 v1.0.0-20140618132640-567b2bfa514e // indirect
118109
gopkg.in/editorconfig/editorconfig-core-go.v1 v1.3.0
119110
gopkg.in/gomail.v2 v2.0.0-20160411212932-81ebce5c23df
120-
gopkg.in/ini.v1 v1.42.0
111+
gopkg.in/ini.v1 v1.46.0
121112
gopkg.in/ldap.v3 v3.0.2
122-
gopkg.in/macaron.v1 v1.3.2
123-
gopkg.in/redis.v2 v2.3.2 // indirect
124113
gopkg.in/src-d/go-billy.v4 v4.3.2
125114
gopkg.in/src-d/go-git.v4 v4.13.1
126115
gopkg.in/stretchr/testify.v1 v1.2.2 // indirect

0 commit comments

Comments
 (0)