blob: 79b53d8bccb40469994feccc4fcc0b68b322a5ca [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
David Pursehouse240fbff2016-08-25 09:58:15 +090091## Markdown
92
93### Disabling markdown
94
95Markdown can be completely disabled by setting render to false.
96
97```
98[markdown]
99 render = false
100```
101
102### Markdown size
103
104Markdown files are limited by default to 5 MiB of input text
105per file. This limit is configurable, but should not be raised
106beyond available memory.
107
108```
109[markdown]
110 inputLimit = 5M
111```
112
113### Image size
114
115Referenced [images are inlined](#Images) as base64 encoded URIs.
116The image limit places an upper bound on the byte size of input.
117
118```
119[markdown]
120 imageLimit = 256K
121```
122
Shawn Pearceb55cf2b2017-06-29 21:56:37 -0700123### Extensions
124
125The following extensions can be enabled/disabled in the markdown
126section:
127
128* `githubFlavor`: enable extensions that mirror GitHub Flavor
129 Markdown behavior. Default is true.
130
131* `autolink`: automatically convert plain URLs and email
David Pursehouse0c122622017-07-02 13:33:58 +0900132 addresses into links. Default follows `githubFlavor`.
Shawn Pearceb55cf2b2017-06-29 21:56:37 -0700133
134* `blocknote`: Gitiles style note/promo/aside blocks to raise
135 awareness to important content. Default false.
136
137* `ghthematicbreak`: accept `--` for `<hr>`, like GitHub Flavor
138 Markdown. Default follows `githubFlavor`.
139
140* `multicolumn`: Gitiles extension to layout content in a 12 cell
141 grid, delinated by section headers. Default false.
142
143* `namedanchor`: Gitiles extension to extract named anchors using
144 `#{id}` syntax. Default false.
145
146* `safehtml`: Gitiles extension to accept very limited HTML; for
147 security reasons all other HTML is dropped regardless of this
148 setting. Default follows `githubFlavor`.
149
150* `smartquote`: Gitiles extension to convert single and double quote
151 ASCII characters to Unicode smart quotes when in prose. Default
152 false.
153
154* `strikethrough`: strikethrough text with GitHub Flavor Markdown
155 style `~~`. Default follows `githubFlavor`.
156
157* `tables`: format tables with GitHub Flavor Markdown. Default
158 follows `githubFlavor`.
159
160* `toc`: Gitiles extension to replace `[TOC]` in a paragraph by itself
161 with a server-side generated table of contents extracted from section
162 headers. Default true.
163
David Pursehousebbcc5132016-08-26 13:26:13 +0900164### IFrames
165
Shawn Pearceb55cf2b2017-06-29 21:56:37 -0700166IFrame support requires `markdown.safehtml` to be true.
167
David Pursehousebbcc5132016-08-26 13:26:13 +0900168IFrame source URLs can be whitelisted by providing a list of allowed
169URLs. URLs ending with a `/` are treated as prefixes, allowing any source
170URL beginning with that prefix.
171
172```
173[markdown]
174 allowiframe = https://google.com/
175```
176
177URLs not ending with a `/` are treated as exact matches, and only those
178source URLs will be allowed.
179
180
181```
182[markdown]
183 allowiframe = https://example.com
184 allowiframe = https://example.org
185```
186
187If the list has a single entry with the value `true`, all source URLs
188will be allowed.
189
190
191```
192[markdown]
193 allowiframe = true
194```
195
David Pursehouse240fbff2016-08-25 09:58:15 +0900196## Google Analytics
197
198[Google Analytics](https://www.google.com/analytics/) can be
199enabled on every rendered markdown page by adding the Property ID
200to the configuration file:
201
202```
203[google]
204 analyticsId = UA-XXXX-Y
205```