blob: c24807bdd5ad51f40a848f28b53ff5aa46a1be88 [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
Dave Borowitzed97b7f2022-06-30 20:28:03 +020050### Fixed time zone
51
52By default dates are formatted including the local user time zone as that
53matches git tools. Some users/administrators may prefer normalizing to a
54particular timezone so times are directly comparable without doing timezone
55arithmetic.
56
57Setting `fixedTimeZone` to a valid Java TimeZone ID causes all dates in the UI
58to be implicitly converted to this timezone, and the now-redundant timezone
59offset to be dropped from the output.
60
61```
62[gitiles]
63 fixedTimeZone = UTC
64```
65
David Pursehousef7018102016-08-25 10:10:23 +090066### Cross-Origin Resource Sharing (CORS)
67
68Gitiles sets the `Access-Control-Allow-Origin` header to the
69HTTP origin of the client if the client's domain matches a regular
70expression defined in `allowOriginRegex`.
71
72```
73[gitiles]
74 allowOriginRegex = http://localhost
75```
76
77By default `allowOriginRegex` is unset, denying all cross-origin requests.
78
David Pursehouse240fbff2016-08-25 09:58:15 +090079## Markdown
80
81### Disabling markdown
82
83Markdown can be completely disabled by setting render to false.
84
85```
86[markdown]
87 render = false
88```
89
90### Markdown size
91
92Markdown files are limited by default to 5 MiB of input text
93per file. This limit is configurable, but should not be raised
94beyond available memory.
95
96```
97[markdown]
98 inputLimit = 5M
99```
100
101### Image size
102
103Referenced [images are inlined](#Images) as base64 encoded URIs.
104The image limit places an upper bound on the byte size of input.
105
106```
107[markdown]
108 imageLimit = 256K
109```
110
Shawn Pearceb55cf2b2017-06-29 21:56:37 -0700111### Extensions
112
113The following extensions can be enabled/disabled in the markdown
114section:
115
116* `githubFlavor`: enable extensions that mirror GitHub Flavor
117 Markdown behavior. Default is true.
118
119* `autolink`: automatically convert plain URLs and email
David Pursehouse0c122622017-07-02 13:33:58 +0900120 addresses into links. Default follows `githubFlavor`.
Shawn Pearceb55cf2b2017-06-29 21:56:37 -0700121
122* `blocknote`: Gitiles style note/promo/aside blocks to raise
123 awareness to important content. Default false.
124
125* `ghthematicbreak`: accept `--` for `<hr>`, like GitHub Flavor
126 Markdown. Default follows `githubFlavor`.
127
128* `multicolumn`: Gitiles extension to layout content in a 12 cell
129 grid, delinated by section headers. Default false.
130
131* `namedanchor`: Gitiles extension to extract named anchors using
132 `#{id}` syntax. Default false.
133
134* `safehtml`: Gitiles extension to accept very limited HTML; for
135 security reasons all other HTML is dropped regardless of this
136 setting. Default follows `githubFlavor`.
137
138* `smartquote`: Gitiles extension to convert single and double quote
139 ASCII characters to Unicode smart quotes when in prose. Default
140 false.
141
142* `strikethrough`: strikethrough text with GitHub Flavor Markdown
143 style `~~`. Default follows `githubFlavor`.
144
145* `tables`: format tables with GitHub Flavor Markdown. Default
146 follows `githubFlavor`.
147
148* `toc`: Gitiles extension to replace `[TOC]` in a paragraph by itself
149 with a server-side generated table of contents extracted from section
150 headers. Default true.
151
David Pursehousebbcc5132016-08-26 13:26:13 +0900152### IFrames
153
Shawn Pearceb55cf2b2017-06-29 21:56:37 -0700154IFrame support requires `markdown.safehtml` to be true.
155
David Pursehousebbcc5132016-08-26 13:26:13 +0900156IFrame source URLs can be whitelisted by providing a list of allowed
157URLs. URLs ending with a `/` are treated as prefixes, allowing any source
158URL beginning with that prefix.
159
160```
161[markdown]
162 allowiframe = https://google.com/
163```
164
165URLs not ending with a `/` are treated as exact matches, and only those
166source URLs will be allowed.
167
168
169```
170[markdown]
171 allowiframe = https://example.com
172 allowiframe = https://example.org
173```
174
175If the list has a single entry with the value `true`, all source URLs
176will be allowed.
177
178
179```
180[markdown]
181 allowiframe = true
182```
183
David Pursehouse240fbff2016-08-25 09:58:15 +0900184## Google Analytics
185
186[Google Analytics](https://www.google.com/analytics/) can be
187enabled on every rendered markdown page by adding the Property ID
188to the configuration file:
189
190```
191[google]
192 analyticsId = UA-XXXX-Y
193```