| David Pursehouse | 240fbff | 2016-08-25 09:58:15 +0900 | [diff] [blame] | 1 | # Configuration |
| 2 | |
| 3 | The `gitiles.config` file supporting the site contains several configuration |
| 4 | options. |
| 5 | |
| 6 | [TOC] |
| 7 | |
| David Pursehouse | f701810 | 2016-08-25 10:10:23 +0900 | [diff] [blame] | 8 | ## Core configuration |
| 9 | |
| 10 | ### Cross-Origin Resource Sharing (CORS) |
| 11 | |
| 12 | Gitiles sets the `Access-Control-Allow-Origin` header to the |
| 13 | HTTP origin of the client if the client's domain matches a regular |
| 14 | expression defined in `allowOriginRegex`. |
| 15 | |
| 16 | ``` |
| 17 | [gitiles] |
| 18 | allowOriginRegex = http://localhost |
| 19 | ``` |
| 20 | |
| 21 | By default `allowOriginRegex` is unset, denying all cross-origin requests. |
| 22 | |
| David Pursehouse | 240fbff | 2016-08-25 09:58:15 +0900 | [diff] [blame] | 23 | ## Markdown |
| 24 | |
| 25 | ### Disabling markdown |
| 26 | |
| 27 | Markdown can be completely disabled by setting render to false. |
| 28 | |
| 29 | ``` |
| 30 | [markdown] |
| 31 | render = false |
| 32 | ``` |
| 33 | |
| 34 | ### Markdown size |
| 35 | |
| 36 | Markdown files are limited by default to 5 MiB of input text |
| 37 | per file. This limit is configurable, but should not be raised |
| 38 | beyond available memory. |
| 39 | |
| 40 | ``` |
| 41 | [markdown] |
| 42 | inputLimit = 5M |
| 43 | ``` |
| 44 | |
| 45 | ### Image size |
| 46 | |
| 47 | Referenced [images are inlined](#Images) as base64 encoded URIs. |
| 48 | The image limit places an upper bound on the byte size of input. |
| 49 | |
| 50 | ``` |
| 51 | [markdown] |
| 52 | imageLimit = 256K |
| 53 | ``` |
| 54 | |
| David Pursehouse | bbcc513 | 2016-08-26 13:26:13 +0900 | [diff] [blame^] | 55 | ### IFrames |
| 56 | |
| 57 | IFrame source URLs can be whitelisted by providing a list of allowed |
| 58 | URLs. URLs ending with a `/` are treated as prefixes, allowing any source |
| 59 | URL beginning with that prefix. |
| 60 | |
| 61 | ``` |
| 62 | [markdown] |
| 63 | allowiframe = https://google.com/ |
| 64 | ``` |
| 65 | |
| 66 | URLs not ending with a `/` are treated as exact matches, and only those |
| 67 | source URLs will be allowed. |
| 68 | |
| 69 | |
| 70 | ``` |
| 71 | [markdown] |
| 72 | allowiframe = https://example.com |
| 73 | allowiframe = https://example.org |
| 74 | ``` |
| 75 | |
| 76 | If the list has a single entry with the value `true`, all source URLs |
| 77 | will be allowed. |
| 78 | |
| 79 | |
| 80 | ``` |
| 81 | [markdown] |
| 82 | allowiframe = true |
| 83 | ``` |
| 84 | |
| David Pursehouse | 240fbff | 2016-08-25 09:58:15 +0900 | [diff] [blame] | 85 | ## Google Analytics |
| 86 | |
| 87 | [Google Analytics](https://www.google.com/analytics/) can be |
| 88 | enabled on every rendered markdown page by adding the Property ID |
| 89 | to the configuration file: |
| 90 | |
| 91 | ``` |
| 92 | [google] |
| 93 | analyticsId = UA-XXXX-Y |
| 94 | ``` |