blob: 9f41e4579b9aeac357745625d3cc85cf4cc250c2 [file] [log] [blame] [view]
David Pursehouse240fbff2016-08-25 09:58:15 +09001# Configuration
2
3The `gitiles.config` file supporting the site contains several configuration
4options.
5
6[TOC]
7
David Pursehousef7018102016-08-25 10:10:23 +09008## Core configuration
9
Antoine Musso0b4abb42022-06-30 22:12:26 +020010### Site Title
11
12The title of the site. Default: `Gitiles`.
13
14```
15[gitiles]
16 siteTitle = Acme Inc. Git Browser
17```
18
Antoine Musso68f511a2022-06-30 22:13:36 +020019### URLs
20
21`canonicalHostName`.
22Default: `null`, determine the hostname from the local host.
23
24`baseGitUrl` the base URL for git repositories.
25
26`gerritUrl`, URL prefix to linkify Gerrit `Change-Id` headers in commit
27messages. If you are using the Gerrit Gitiles plugin, this is set based on
28Gerrit's configuration.
29Default: `null`, do not link `Change-Id`.
30
31```
32[gitiles]
33 canonicalHostName = gitiles.example.org
34 gerritUrl = https://gerrit.example.org/r/
35 baseGitUrl = git://git.example.org/
36```
37
Antoine Musso33d4c132022-06-30 22:14:13 +020038### Repositories export
39
40Set `exportAll` to instruct jGit to export all repositories, ignoring the check
41for existence of `git-daemon-export-ok` file at the root of the repository.
42
43Default: `false`, repositories need to be explicitly marked for export.
44
45```
46[gitiles]
47exportAll = true
48```
49
Antoine Mussoda9134f2022-06-30 22:14:33 +020050### Custom templating
51
52The web views are defined via Soy templates, you inject your own version which
53will be passed to the renderer. See `.soy` files in the source code for
54available templates
55
56```
57[gitiles]
58customTemplates = path/to/somefile.soy
59customTemplates = path/to/another.soy
60```
61
Dave Borowitzed97b7f2022-06-30 20:28:03 +020062### Fixed time zone
63
64By default dates are formatted including the local user time zone as that
65matches git tools. Some users/administrators may prefer normalizing to a
66particular timezone so times are directly comparable without doing timezone
67arithmetic.
68
69Setting `fixedTimeZone` to a valid Java TimeZone ID causes all dates in the UI
70to be implicitly converted to this timezone, and the now-redundant timezone
71offset to be dropped from the output.
72
73```
74[gitiles]
75 fixedTimeZone = UTC
76```
77
David Pursehousef7018102016-08-25 10:10:23 +090078### Cross-Origin Resource Sharing (CORS)
79
80Gitiles sets the `Access-Control-Allow-Origin` header to the
81HTTP origin of the client if the client's domain matches a regular
82expression defined in `allowOriginRegex`.
83
84```
85[gitiles]
86 allowOriginRegex = http://localhost
87```
88
89By default `allowOriginRegex` is unset, denying all cross-origin requests.
90
Antoine Musso07e21422022-06-30 22:14:59 +020091### Gitweb redirector
92
93Redirect requests to old gitweb URLs after having migrated to Gitiles. Matching
94URLs will be redirected permanently to their Gitiles equivalent.
95Default: `true`.
96
97```
98[gitiles]
99redirectGitweb = false
100```
101
David Pursehouse240fbff2016-08-25 09:58:15 +0900102## Markdown
103
104### Disabling markdown
105
106Markdown can be completely disabled by setting render to false.
107
108```
109[markdown]
110 render = false
111```
112
113### Markdown size
114
115Markdown files are limited by default to 5 MiB of input text
116per file. This limit is configurable, but should not be raised
117beyond available memory.
118
119```
120[markdown]
121 inputLimit = 5M
122```
123
124### Image size
125
126Referenced [images are inlined](#Images) as base64 encoded URIs.
127The image limit places an upper bound on the byte size of input.
128
129```
130[markdown]
131 imageLimit = 256K
132```
133
Shawn Pearceb55cf2b2017-06-29 21:56:37 -0700134### Extensions
135
136The following extensions can be enabled/disabled in the markdown
137section:
138
139* `githubFlavor`: enable extensions that mirror GitHub Flavor
140 Markdown behavior. Default is true.
141
142* `autolink`: automatically convert plain URLs and email
David Pursehouse0c122622017-07-02 13:33:58 +0900143 addresses into links. Default follows `githubFlavor`.
Shawn Pearceb55cf2b2017-06-29 21:56:37 -0700144
145* `blocknote`: Gitiles style note/promo/aside blocks to raise
146 awareness to important content. Default false.
147
148* `ghthematicbreak`: accept `--` for `<hr>`, like GitHub Flavor
149 Markdown. Default follows `githubFlavor`.
150
151* `multicolumn`: Gitiles extension to layout content in a 12 cell
152 grid, delinated by section headers. Default false.
153
154* `namedanchor`: Gitiles extension to extract named anchors using
155 `#{id}` syntax. Default false.
156
157* `safehtml`: Gitiles extension to accept very limited HTML; for
158 security reasons all other HTML is dropped regardless of this
159 setting. Default follows `githubFlavor`.
160
161* `smartquote`: Gitiles extension to convert single and double quote
162 ASCII characters to Unicode smart quotes when in prose. Default
163 false.
164
165* `strikethrough`: strikethrough text with GitHub Flavor Markdown
166 style `~~`. Default follows `githubFlavor`.
167
168* `tables`: format tables with GitHub Flavor Markdown. Default
169 follows `githubFlavor`.
170
171* `toc`: Gitiles extension to replace `[TOC]` in a paragraph by itself
172 with a server-side generated table of contents extracted from section
173 headers. Default true.
174
David Pursehousebbcc5132016-08-26 13:26:13 +0900175### IFrames
176
Shawn Pearceb55cf2b2017-06-29 21:56:37 -0700177IFrame support requires `markdown.safehtml` to be true.
178
David Pursehousebbcc5132016-08-26 13:26:13 +0900179IFrame source URLs can be whitelisted by providing a list of allowed
180URLs. URLs ending with a `/` are treated as prefixes, allowing any source
181URL beginning with that prefix.
182
183```
184[markdown]
185 allowiframe = https://google.com/
186```
187
188URLs not ending with a `/` are treated as exact matches, and only those
189source URLs will be allowed.
190
191
192```
193[markdown]
194 allowiframe = https://example.com
195 allowiframe = https://example.org
196```
197
198If the list has a single entry with the value `true`, all source URLs
199will be allowed.
200
201
202```
203[markdown]
204 allowiframe = true
205```
206
David Pursehouse240fbff2016-08-25 09:58:15 +0900207## Google Analytics
208
209[Google Analytics](https://www.google.com/analytics/) can be
210enabled on every rendered markdown page by adding the Property ID
211to the configuration file:
212
213```
214[google]
215 analyticsId = UA-XXXX-Y
216```