You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
procd_set_param respawn ${respawn_threshold:-3600}${respawn_timeout:-5}${respawn_retry:-5}# respawn automatically if something died, be careful if you have an alternative process supervisor
Copy file name to clipboardExpand all lines: docs/content/doc/advanced/config-cheat-sheet.en-us.md
+2-2
Original file line number
Diff line number
Diff line change
@@ -1003,13 +1003,13 @@ IS_INPUT_FILE = false
1003
1003
command. Multiple extensions needs a comma as splitter.
1004
1004
- RENDER\_COMMAND: External command to render all matching extensions.
1005
1005
- IS\_INPUT\_FILE: **false** Input is not a standard input but a file param followed `RENDER_COMMAND`.
1006
+
- DISABLE_SANITIZER: **false** Don't filter html tags and attributes if true. Don't change this to true except you know what that means.
1006
1007
1007
1008
Two special environment variables are passed to the render command:
1008
1009
-`GITEA_PREFIX_SRC`, which contains the current URL prefix in the `src` path tree. To be used as prefix for links.
1009
1010
-`GITEA_PREFIX_RAW`, which contains the current URL prefix in the `raw` path tree. To be used as prefix for image paths.
1010
1011
1011
-
1012
-
Gitea supports customizing the sanitization policy for rendered HTML. The example below will support KaTeX output from pandoc.
1012
+
If `DISABLE_SANITIZER` is false, Gitea supports customizing the sanitization policy for rendered HTML. The example below will support KaTeX output from pandoc.
Copy file name to clipboardExpand all lines: docs/content/doc/developers/guidelines-backend.md
+12-2
Original file line number
Diff line number
Diff line change
@@ -42,7 +42,7 @@ To maintain understandable code and avoid circular dependencies it is important
42
42
-`modules/setting`: Store all system configurations read from ini files and has been referenced by everywhere. But they should be used as function parameters when possible.
43
43
-`modules/git`: Package to interactive with `Git` command line or Gogit package.
-`routers`: Handling of server requests. As it uses other Gitea packages to serve the request, other packages (models, modules or services) shall not depend on routers.
45
+
-`routers`: Handling of server requests. As it uses other Gitea packages to serve the request, other packages (models, modules or services) must not depend on routers.
46
46
-`routers/api` Contains routers for `/api/v1` aims to handle RESTful API requests.
47
47
-`routers/install` Could only respond when system is in INSTALL mode (INSTALL_LOCK=false).
48
48
-`routers/private` will only be invoked by internal sub commands, especially `serv` and `hooks`.
@@ -106,10 +106,20 @@ i.e. `servcies/user`, `models/repository`.
106
106
Since there are some packages which use the same package name, it is possible that you find packages like `modules/user`, `models/user`, and `services/user`. When these packages are imported in one Go file, it's difficult to know which package we are using and if it's a variable name or an import name. So, we always recommend to use import aliases. To differ from package variables which are commonly in camelCase, just use **snake_case** for import aliases.
107
107
i.e. `import user_service "code.gitea.io/gitea/services/user"`
108
108
109
+
### Important Gotchas
110
+
111
+
- Never write `x.Update(exemplar)` without an explicit `WHERE` clause:
112
+
- This will cause all rows in the table to be updated with the non-zero values of the exemplar - including IDs.
113
+
- You should usually write `x.ID(id).Update(exemplar)`.
114
+
- If during a migration you are inserting into a table using `x.Insert(exemplar)` where the ID is preset:
115
+
- You will need to ``SET IDENTITY_INSERT `table` ON`` for the MSSQL variant (the migration will fail otherwise)
116
+
- However, you will also need to update the id sequence for postgres - the migration will silently pass here but later insertions will fail:
117
+
``SELECT setval('table_name_id_seq', COALESCE((SELECT MAX(id)+1 FROM `table_name`), 1), false)``
118
+
109
119
### Future Tasks
110
120
111
121
Currently, we are creating some refactors to do the following things:
112
122
113
123
- Correct that codes which doesn't follow the rules.
114
124
- There are too many files in `models`, so we are moving some of them into a sub package `models/xxx`.
115
-
- Some `modules` sub packages should be moved to `services` because they depends on `models`.
125
+
- Some `modules` sub packages should be moved to `services` because they depend on `models`.
0 commit comments