]> BookStack Code Mirror - website/blob - content/docs/admin/other-config.md
Actualiser content/docs/admin/installation.md
[website] / content / docs / admin / other-config.md
1 +++
2 title = "Other Configuration"
3 description = "Other BookStack configuration such as system revisions and custom avatar fetching"
4 date = "2018-01-12"
5 type = "admin-doc"
6 +++
7
8
9 * [.env Options](#env-options)
10 * [Revision Limit](#revision-limit)
11 * [Recycle Bin Lifetime](#recycle-bin-lifetime )
12 * [Custom User Avatar Fetching](#custom-user-avatar-fetching)
13 * [Custom diagrams.net URL](#custom-diagramsnet-url)
14 * [IP Address Storage Precision](#ip-address-storage-precision)
15
16 ---
17
18 ### .env Options
19
20 As part of the installation of BookStack you will have a `.env` file containing system options. By default this only contains a few options.
21 Within your BookStack install directory you should also have a `.env.example.complete` file which contains every supported option available alongside the default value for each.
22 You can copy options in this file to your own `.env` file as required. Many of the options in the `.env.example.complete` file are detailed in-depth in this documentation.
23
24 The `.env` file essentially sets environment variables for BookStack to read. Environment variables will be checked if an option is not in the `.env` file which can be useful
25 in the creation and use of docker containers.
26
27 ---
28
29 ### Revision Limit
30
31 Each time a page is saved a revision is stored to track history. To prevent your database becoming bloated BookStack will automatically remove revisions when the count, per page, exceeds 100. You can set the following option in your `.env` file to increase or remove the limit:
32
33 ```bash
34 # Set the revision limit to 200
35 # Defaults to '100'
36 REVISION_LIMIT=200
37
38 # Alternatively, You can set to 'false' to disable the limit altogether.
39 REVISION_LIMIT=false
40 ```
41
42 Keep in mind that BookStack itself may automatically update pages and create revisions in certain circumstances (Auto-updating of links for example).
43
44 ---
45
46 ### Recycle Bin Lifetime
47
48 By default BookStack content in the recycle bin has a lifetime of 30 days before being considered for auto-removal.
49 Content won't specifically be deleted after this time, but BookStack will check the recycle bin on certain events 
50 (New items sent to the recycle bin) and it will auto-remove items older than this length of time.
51
52 This lifetime is configurable, and you can alternatively tell BookStack to never auto-remove recycle bin items, 
53 or to instead not use the recycle bin at all. This is controlled by a `RECYCLE_BIN_LIFETIME` option in the `.env` file like so:
54
55 ```bash
56 # Set a recycle bin item lifetime of 100 days
57 RECYCLE_BIN_LIFETIME=100
58
59 # Never auto-remove recycle bin content
60 RECYCLE_BIN_LIFETIME=-1
61
62 # Disable use of the recycle bin (Auto-removes instantly)
63 RECYCLE_BIN_LIFETIME=0
64 ```
65
66 ---
67
68 ### Custom User Avatar Fetching
69
70 When a user is created BookStack will, by default, fetch an avatar image from [Gravatar](https://en.gravatar.com/).
71 This functionality can be disabled, or the URL can be customized, which allows you to use a different avatar service altogether.
72 This is handled by defining an `AVATAR_URL` option in your `.env` as can be seen below:
73
74 ```bash
75 # Use libravatar instead of gravatar
76 AVATAR_URL=https://seccdn.libravatar.org/avatar/${hash}?s=${size}&d=identicon
77
78 # Disable avatar fetching altogether
79 AVATAR_URL=false
80 ```
81
82 The following variables can be used in this setting which will be populated by BookStack when used:
83
84 * `${email}` - The user's email address, URL encoded.
85 * `${hash}` - MD5 hashed copy of the user's email address.
86 * `${size}` - BookStack's ideal requested image size in pixels.
87
88 ---
89
90 ### Custom diagrams.net URL
91
92 BookStack uses [diagrams.net](https://www.diagrams.net/) (formerly draw.io) to provide users with the ability to create & edit drawings.
93 By default BookStack embeds the diagrams.net interface using the following URL:
94
95 ```php
96 https://embed.diagrams.net/?embed=1&proto=json&spin=1&configure=1
97 ```
98
99 You can instead define your own URL to customise this embed or even use a self-hosted
100 instance of diagrams.net. This can be done by defining an option in your `.env` file like so:
101
102 ```bash
103 DRAWIO=https://drawing.example.com/?embed=1&proto=json&spin=1&configure=1
104 ```
105
106 **The `embed=1&proto=json&spin=1` query string parameters are required for the integration with BookStack to function. Remember to include these when defining a custom URL.**
107
108 Refer to this diagrams.net guide to see what options are supported: [diagrams.net embed URL parameters](https://www.diagrams.net/doc/faq/supported-url-parameters). In particular, the `stealth=1` option might be of interest if you 
109 don't want other external services to be used. 
110
111 ---
112
113 ### IP Address Storage Precision
114
115 Some areas of BookStack, such as the activity audit log, store and show IP address of users.
116 By default, the entire IP address will be stored but you can adjust with the following `.env` option:
117
118 ```bash
119 # Alter the precision of IP addresses stored by BookStack.
120 # Should be a number between 0 and 4, where 4 retains the full IP address
121 # and 0 completely hides the IP address. As an example, a value of 2 for the
122 # IP address '146.191.42.4' would result in '146.191.x.x' being logged.
123 # For the IPv6 address '2001:db8:85a3:8d3:1319:8a2e:370:7348' this would result as:
124 # '2001:db8:85a3:8d3:x:x:x:x'
125 IP_ADDRESS_PRECISION=2
126 ```