Skip to content

Commit 0cd87d6

Browse files
authored
Update docs and comments to remove macaron (#14491)
1 parent 25b6255 commit 0cd87d6

29 files changed

+32
-78
lines changed

custom/conf/app.example.ini

-2
Original file line numberDiff line numberDiff line change
@@ -863,8 +863,6 @@ ROOT_PATH =
863863
MODE = console
864864
; Buffer length of the channel, keep it as it is if you don't know what it is.
865865
BUFFER_LEN = 10000
866-
REDIRECT_MACARON_LOG = false
867-
MACARON = file
868866
; Either "Trace", "Debug", "Info", "Warn", "Error", "Critical", default is "Info"
869867
ROUTER_LOG_LEVEL = Info
870868
ROUTER = console

docker/root/etc/templates/app.ini

-2
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,6 @@ PATH = /data/gitea/attachments
4747
[log]
4848
MODE = console
4949
LEVEL = info
50-
REDIRECT_MACARON_LOG = true
51-
MACARON = console
5250
ROUTER = console
5351
ROOT_PATH = /data/gitea/log
5452

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -611,7 +611,7 @@ Default templates for project boards:
611611
- `STACKTRACE_LEVEL`: **None**: Default log level at which to log create stack traces. \[Trace, Debug, Info, Warn, Error, Critical, Fatal, None\]
612612
- `ROUTER_LOG_LEVEL`: **Info**: The log level that the router should log at. (If you are setting the access log, its recommended to place this at Debug.)
613613
- `ROUTER`: **console**: The mode or name of the log the router should log to. (If you set this to `,` it will log to default gitea logger.)
614-
NB: You must `REDIRECT_MACARON_LOG` and have `DISABLE_ROUTER_LOG` set to `false` for this option to take effect. Configure each mode in per mode log subsections `\[log.modename.router\]`.
614+
NB: You must have `DISABLE_ROUTER_LOG` set to `false` for this option to take effect. Configure each mode in per mode log subsections `\[log.modename.router\]`.
615615
- `ENABLE_ACCESS_LOG`: **false**: Creates an access.log in NCSA common log format, or as per the following template
616616
- `ACCESS`: **file**: Logging mode for the access logger, use a comma to separate values. Configure each mode in per mode log subsections `\[log.modename.access\]`. By default the file mode will log to `$ROOT_PATH/access.log`. (If you set this to `,` it will log to the default gitea logger.)
617617
- `ACCESS_LOG_TEMPLATE`: **`{{.Ctx.RemoteAddr}} - {{.Identity}} {{.Start.Format "[02/Jan/2006:15:04:05 -0700]" }} "{{.Ctx.Req.Method}} {{.Ctx.Req.URL.RequestURI}} {{.Ctx.Req.Proto}}" {{.ResponseWriter.Status}} {{.ResponseWriter.Size}} "{{.Ctx.Req.Referer}}\" \"{{.Ctx.Req.UserAgent}}"`**: Sets the template used to create the access log.

docs/content/doc/advanced/environment-variables.en-us.md

-9
Original file line numberDiff line numberDiff line change
@@ -58,15 +58,6 @@ For documentation about each of the variables available, refer to the
5858
- `HOMEDRIVE`: Main drive path used to access the home directory (C:)
5959
- `HOMEPATH`: Home relative path in the given home drive path
6060

61-
## Macaron (framework used by Gitea)
62-
63-
- `HOST`: Host Macaron will listen on
64-
- `PORT`: Port Macaron will listen on
65-
- `MACARON_ENV`: global variable to provide special functionality for development environments
66-
vs. production environments. If MACARON_ENV is set to "" or "development", then templates will
67-
be recompiled on every request. For more performance, set the MACARON_ENV environment variable
68-
to "production".
69-
7061
## Miscellaneous
7162

7263
- `SKIP_MINWINSVC`: If set to 1, do not run as a service on Windows.

docs/content/doc/advanced/environment-variables.zh-cn.md

-7
Original file line numberDiff line numberDiff line change
@@ -50,13 +50,6 @@ GITEA_CUSTOM=/home/gitea/custom ./gitea web
5050
* `HOMEDRIVE`: 用于访问 home 目录的主驱动器路径(C盘)
5151
* `HOMEPATH`:在指定主驱动器下的 home 目录相对路径
5252

53-
## Macaron(Gitea 使用的 web 框架)
54-
55-
* `HOST`:Macaron 监听的主机地址
56-
* `PORT`:Macaron 监听的端口地址
57-
* `MACARON_ENV`:为开发环境和生产环境提供特殊功能性配置的全局变量,当 MACARON_ENV 设置为 "" 或 "development"
58-
时,每次请求都会重编译页面模板。为了提高性能表现,可将它设置为 "production"。
59-
6053
## Miscellaneous
6154

6255
* `SKIP_MINWINSVC`:如果设置为 1,在 Windows 上不会以 service 的形式运行。

docs/content/doc/advanced/logging-documentation.en-us.md

+3-8
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ The fundamental thing to be aware of in Gitea is that there are several
2727
log groups:
2828

2929
- The "Default" logger
30-
- The Macaron logger
3130
- The Router logger
3231
- The Access logger
3332
- The XORM logger
@@ -74,8 +73,7 @@ You can disable Router log by setting `DISABLE_ROUTER_LOG`.
7473
You can configure the outputs of this
7574
router log by setting the `ROUTER` value in the `[log]` section of the
7675
configuration. `ROUTER` will default to `console` if unset. The Gitea
77-
Router logs the same data as the Macaron log but has slightly different
78-
coloring. It logs at the `Info` level by default, but this can be
76+
Router logs at the `Info` level by default, but this can be
7977
changed if desired by setting the `ROUTER_LOG_LEVEL` value.
8078

8179
Please note, setting the `LEVEL` of this logger to a level above
@@ -182,7 +180,7 @@ Certain configuration is common to all modes of log output:
182180
- `STACKTRACE_LEVEL` is the lowest level that this output will print
183181
a stacktrace. This value is inherited.
184182
- `MODE` is the mode of the log output. It will default to the sublogger
185-
name. Thus `[log.console.macaron]` will default to `MODE = console`.
183+
name. Thus `[log.console.router]` will default to `MODE = console`.
186184
- `COLORIZE` will default to `true` for `console` as
187185
described, otherwise it will default to `false`.
188186

@@ -280,8 +278,6 @@ LOG_SQL = false ; SQL logs are rarely helpful unless we specifically ask for the
280278
[log]
281279
MODE = console
282280
LEVEL = debug ; please set the level to debug when we are debugging a problem
283-
REDIRECT_MACARON_LOG = true
284-
MACARON = console
285281
ROUTER = console
286282
COLORIZE = false ; this can be true if you can strip out the ansi coloring
287283
```
@@ -314,7 +310,6 @@ ROOT_PATH = %(GITEA_WORK_DIR)/log
314310
MODE = console
315311
LEVEL = Info
316312
STACKTRACE_LEVEL = None
317-
REDIRECT_MACARON_LOG = false
318313
ENABLE_ACCESS_LOG = false
319314
ENABLE_XORM_LOG = true
320315
XORM = ,
@@ -345,7 +340,7 @@ recommended that pausing only done for a very short period of time.
345340
## Adding and removing logging whilst Gitea is running
346341

347342
It is possible to add and remove logging whilst Gitea is running using the `gitea manager logging add` and `remove` subcommands.
348-
This functionality can only adjust running log systems and cannot be used to start the access, macaron or router loggers if they
343+
This functionality can only adjust running log systems and cannot be used to start the access or router loggers if they
349344
were not already initialised. If you wish to start these systems you are advised to adjust the app.ini and (gracefully) restart
350345
the Gitea service.
351346

integrations/mssql.ini.tmpl

-2
Original file line numberDiff line numberDiff line change
@@ -78,9 +78,7 @@ PROVIDER_CONFIG = integrations/gitea-integration-mssql/data/sessions
7878
[log]
7979
MODE = test,file
8080
ROOT_PATH = mssql-log
81-
REDIRECT_MACARON_LOG = true
8281
ROUTER = ,
83-
MACARON = ,
8482
XORM = file
8583

8684
[log.test]

integrations/mysql.ini.tmpl

-2
Original file line numberDiff line numberDiff line change
@@ -97,9 +97,7 @@ PROVIDER_CONFIG = integrations/gitea-integration-mysql/data/sessions
9797
[log]
9898
MODE = test,file
9999
ROOT_PATH = mysql-log
100-
REDIRECT_MACARON_LOG = true
101100
ROUTER = ,
102-
MACARON = ,
103101
XORM = file
104102

105103
[log.test]

integrations/mysql8.ini.tmpl

-2
Original file line numberDiff line numberDiff line change
@@ -70,9 +70,7 @@ PROVIDER_CONFIG = data/sessions-mysql8
7070
[log]
7171
MODE = test,file
7272
ROOT_PATH = mysql8-log
73-
REDIRECT_MACARON_LOG = true
7473
ROUTER = ,
75-
MACARON = ,
7674
XORM = file
7775

7876
[log.test]

integrations/oauth_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@ func TestRefreshTokenInvalidation(t *testing.T) {
235235
"redirect_uri": "a",
236236
"refresh_token": parsed.RefreshToken,
237237
})
238-
// tip: Why this changed, because macaron will set req.Body back when consume the req but chi will not.
238+
239239
bs, err := ioutil.ReadAll(refreshReq.Body)
240240
assert.NoError(t, err)
241241

integrations/pgsql.ini.tmpl

-2
Original file line numberDiff line numberDiff line change
@@ -79,9 +79,7 @@ PROVIDER_CONFIG = integrations/gitea-integration-pgsql/data/sessions
7979
[log]
8080
MODE = test,file
8181
ROOT_PATH = pgsql-log
82-
REDIRECT_MACARON_LOG = true
8382
ROUTER = ,
84-
MACARON = ,
8583
XORM = file
8684

8785
[log.test]

integrations/sqlite.ini.tmpl

-2
Original file line numberDiff line numberDiff line change
@@ -75,9 +75,7 @@ PROVIDER_CONFIG = integrations/gitea-integration-sqlite/data/sessions
7575
[log]
7676
MODE = test,file
7777
ROOT_PATH = sqlite-log
78-
REDIRECT_MACARON_LOG = true
7978
ROUTER = ,
80-
MACARON = ,
8179
XORM = file
8280

8381
[log.test]

modules/context/api.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ import (
2323
"gitea.com/go-chi/session"
2424
)
2525

26-
// APIContext is a specific macaron context for API service
26+
// APIContext is a specific context for API service
2727
type APIContext struct {
2828
*Context
2929
Org *APIOrganization
@@ -217,7 +217,7 @@ func (ctx *APIContext) CheckForOTP() {
217217
}
218218
}
219219

220-
// APIContexter returns apicontext as macaron middleware
220+
// APIContexter returns apicontext as middleware
221221
func APIContexter() func(http.Handler) http.Handler {
222222
var csrfOpts = getCsrfOpts()
223223

modules/context/org.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ func HandleOrgAssignment(ctx *Context, args ...bool) {
170170
}
171171
}
172172

173-
// OrgAssignment returns a macaron middleware to handle organization assignment
173+
// OrgAssignment returns a middleware to handle organization assignment
174174
func OrgAssignment(args ...bool) func(ctx *Context) {
175175
return func(ctx *Context) {
176176
HandleOrgAssignment(ctx, args...)

modules/context/permission.go

+5-5
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import (
99
"code.gitea.io/gitea/modules/log"
1010
)
1111

12-
// RequireRepoAdmin returns a macaron middleware for requiring repository admin permission
12+
// RequireRepoAdmin returns a middleware for requiring repository admin permission
1313
func RequireRepoAdmin() func(ctx *Context) {
1414
return func(ctx *Context) {
1515
if !ctx.IsSigned || !ctx.Repo.IsAdmin() {
@@ -19,7 +19,7 @@ func RequireRepoAdmin() func(ctx *Context) {
1919
}
2020
}
2121

22-
// RequireRepoWriter returns a macaron middleware for requiring repository write to the specify unitType
22+
// RequireRepoWriter returns a middleware for requiring repository write to the specify unitType
2323
func RequireRepoWriter(unitType models.UnitType) func(ctx *Context) {
2424
return func(ctx *Context) {
2525
if !ctx.Repo.CanWrite(unitType) {
@@ -29,7 +29,7 @@ func RequireRepoWriter(unitType models.UnitType) func(ctx *Context) {
2929
}
3030
}
3131

32-
// RequireRepoWriterOr returns a macaron middleware for requiring repository write to one of the unit permission
32+
// RequireRepoWriterOr returns a middleware for requiring repository write to one of the unit permission
3333
func RequireRepoWriterOr(unitTypes ...models.UnitType) func(ctx *Context) {
3434
return func(ctx *Context) {
3535
for _, unitType := range unitTypes {
@@ -41,7 +41,7 @@ func RequireRepoWriterOr(unitTypes ...models.UnitType) func(ctx *Context) {
4141
}
4242
}
4343

44-
// RequireRepoReader returns a macaron middleware for requiring repository read to the specify unitType
44+
// RequireRepoReader returns a middleware for requiring repository read to the specify unitType
4545
func RequireRepoReader(unitType models.UnitType) func(ctx *Context) {
4646
return func(ctx *Context) {
4747
if !ctx.Repo.CanRead(unitType) {
@@ -67,7 +67,7 @@ func RequireRepoReader(unitType models.UnitType) func(ctx *Context) {
6767
}
6868
}
6969

70-
// RequireRepoReaderOr returns a macaron middleware for requiring repository write to one of the unit permission
70+
// RequireRepoReaderOr returns a middleware for requiring repository write to one of the unit permission
7171
func RequireRepoReaderOr(unitTypes ...models.UnitType) func(ctx *Context) {
7272
return func(ctx *Context) {
7373
for _, unitType := range unitTypes {

modules/context/private.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ func GetPrivateContext(req *http.Request) *PrivateContext {
2828
return req.Context().Value(privateContextKey).(*PrivateContext)
2929
}
3030

31-
// PrivateContexter returns apicontext as macaron middleware
31+
// PrivateContexter returns apicontext as middleware
3232
func PrivateContexter() func(http.Handler) http.Handler {
3333
return func(next http.Handler) http.Handler {
3434
return http.HandlerFunc(func(w http.ResponseWriter, req *http.Request) {

modules/context/repo.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -373,7 +373,7 @@ func repoAssignment(ctx *Context, repo *models.Repository) {
373373
ctx.Data["IsEmptyRepo"] = ctx.Repo.Repository.IsEmpty
374374
}
375375

376-
// RepoIDAssignment returns a macaron handler which assigns the repo to the context.
376+
// RepoIDAssignment returns a handler which assigns the repo to the context.
377377
func RepoIDAssignment() func(ctx *Context) {
378378
return func(ctx *Context) {
379379
repoID := ctx.ParamsInt64(":repoid")
@@ -393,7 +393,7 @@ func RepoIDAssignment() func(ctx *Context) {
393393
}
394394
}
395395

396-
// RepoAssignment returns a macaron to handle repository assignment
396+
// RepoAssignment returns a middleware to handle repository assignment
397397
func RepoAssignment() func(http.Handler) http.Handler {
398398
return func(next http.Handler) http.Handler {
399399
return http.HandlerFunc(func(w http.ResponseWriter, req *http.Request) {
@@ -849,7 +849,7 @@ func GitHookService() func(ctx *Context) {
849849
}
850850
}
851851

852-
// UnitTypes returns a macaron middleware to set unit types to context variables.
852+
// UnitTypes returns a middleware to set unit types to context variables.
853853
func UnitTypes() func(ctx *Context) {
854854
return func(ctx *Context) {
855855
ctx.Data["UnitTypeCode"] = models.UnitTypeCode

modules/log/log.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,7 @@ func NewLoggerAsWriter(level string, ourLoggers ...*MultiChannelledLogger) *Logg
267267
return l
268268
}
269269

270-
// Write implements the io.Writer interface to allow spoofing of macaron
270+
// Write implements the io.Writer interface to allow spoofing of chi
271271
func (l *LoggerAsWriter) Write(p []byte) (int, error) {
272272
for _, logger := range l.ourLoggers {
273273
// Skip = 3 because this presumes that we have been called by log.Println()

modules/public/dynamic.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import (
1313
"time"
1414
)
1515

16-
// Static implements the macaron static handler for serving assets.
16+
// Static implements the static handler for serving assets.
1717
func Static(opts *Options) func(next http.Handler) http.Handler {
1818
return opts.staticHandler(opts.Directory)
1919
}

modules/public/public.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import (
1515
"code.gitea.io/gitea/modules/setting"
1616
)
1717

18-
// Options represents the available options to configure the macaron handler.
18+
// Options represents the available options to configure the handler.
1919
type Options struct {
2020
Directory string
2121
IndexFile string
@@ -34,7 +34,7 @@ var KnownPublicEntries = []string{
3434
"favicon.ico",
3535
}
3636

37-
// Custom implements the macaron static handler for serving custom assets.
37+
// Custom implements the static handler for serving custom assets.
3838
func Custom(opts *Options) func(next http.Handler) http.Handler {
3939
return opts.staticHandler(path.Join(setting.CustomPath, "public"))
4040
}

modules/public/static.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import (
2020
"code.gitea.io/gitea/modules/log"
2121
)
2222

23-
// Static implements the macaron static handler for serving assets.
23+
// Static implements the static handler for serving assets.
2424
func Static(opts *Options) func(next http.Handler) http.Handler {
2525
opts.FileSystem = Assets
2626
// we don't need to pass the directory, because the directory var is only

modules/setting/log.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,7 @@ func newRouterLogService() {
273273
// Allow [log] DISABLE_ROUTER_LOG to override [server] DISABLE_ROUTER_LOG
274274
DisableRouterLog = Cfg.Section("log").Key("DISABLE_ROUTER_LOG").MustBool(DisableRouterLog)
275275

276-
if !DisableRouterLog && RedirectMacaronLog {
276+
if !DisableRouterLog {
277277
options := newDefaultLogOptions()
278278
options.filename = filepath.Join(LogRootPath, "router.log")
279279
options.flags = "date,time" // For the router we don't want any prefixed flags

modules/setting/setting.go

-2
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,6 @@ var (
288288
LogLevel string
289289
StacktraceLogLevel string
290290
LogRootPath string
291-
RedirectMacaronLog bool
292291
DisableRouterLog bool
293292
RouterLogLevel log.Level
294293
RouterLogMode string
@@ -539,7 +538,6 @@ func NewContext() {
539538
StacktraceLogLevel = getStacktraceLogLevel(Cfg.Section("log"), "STACKTRACE_LEVEL", "None")
540539
LogRootPath = Cfg.Section("log").Key("ROOT_PATH").MustString(path.Join(AppWorkPath, "log"))
541540
forcePathSeparator(LogRootPath)
542-
RedirectMacaronLog = Cfg.Section("log").Key("REDIRECT_MACARON_LOG").MustBool(false)
543541
RouterLogLevel = log.FromString(Cfg.Section("log").Key("ROUTER_LOG_LEVEL").MustString("Info"))
544542

545543
sec := Cfg.Section("server")

modules/translation/translation.go

-1
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@ func InitLocales() {
4949
}
5050
}
5151

52-
// These codes will be used once macaron removed
5352
tags := make([]language.Tag, len(setting.Langs))
5453
for i, lang := range setting.Langs {
5554
tags[i] = language.Raw.Make(lang)

options/locale/locale_en-US.ini

-1
Original file line numberDiff line numberDiff line change
@@ -2402,7 +2402,6 @@ config.git_gc_timeout = GC Operation Timeout
24022402

24032403
config.log_config = Log Configuration
24042404
config.log_mode = Log Mode
2405-
config.macaron_log_mode = Macaron Log Mode
24062405
config.own_named_logger = Named Logger
24072406
config.routes_to_default_logger = Routes To Default Logger
24082407
config.go_log = Uses Go Log (redirected to default)

routers/admin/admin.go

-1
Original file line numberDiff line numberDiff line change
@@ -308,7 +308,6 @@ func Config(ctx *context.Context) {
308308

309309
ctx.Data["EnvVars"] = envVars
310310
ctx.Data["Loggers"] = setting.GetLogDescriptions()
311-
ctx.Data["RedirectMacaronLog"] = setting.RedirectMacaronLog
312311
ctx.Data["EnableAccessLog"] = setting.EnableAccessLog
313312
ctx.Data["AccessLogTemplate"] = setting.AccessLogTemplate
314313
ctx.Data["DisableRouterLog"] = setting.DisableRouterLog

routers/install.go

-2
Original file line numberDiff line numberDiff line change
@@ -371,8 +371,6 @@ func InstallPost(ctx *context.Context) {
371371
cfg.Section("log").Key("MODE").SetValue("console")
372372
cfg.Section("log").Key("LEVEL").SetValue(setting.LogLevel)
373373
cfg.Section("log").Key("ROOT_PATH").SetValue(form.LogRootPath)
374-
cfg.Section("log").Key("REDIRECT_MACARON_LOG").SetValue("true")
375-
cfg.Section("log").Key("MACARON").SetValue("console")
376374
cfg.Section("log").Key("ROUTER").SetValue("console")
377375

378376
cfg.Section("security").Key("INSTALL_LOCK").SetValue("true")

routers/routes/web.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ func WebRoutes() *web.Route {
215215
return r
216216
}
217217

218-
// RegisterRoutes routes routes to Macaron
218+
// RegisterRoutes register routes
219219
func RegisterRoutes(m *web.Route) {
220220
reqSignIn := context.Toggle(&context.ToggleOptions{SignInRequired: true})
221221
ignSignIn := context.Toggle(&context.ToggleOptions{SignInRequired: setting.Service.RequireSignInView})

0 commit comments

Comments
 (0)