You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+35-15Lines changed: 35 additions & 15 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -26,7 +26,30 @@ npm install
26
26
27
27
### Step 2: add your configuration
28
28
29
-
Add your Postgres connection information to `config/index.json.txt` and rename it `index.json`. Information on the config options can be found [here](config/README.md).
29
+
Dirt is configured via environmental variables. These variables can be placed in a `.env` file in the project's root folder, via the command line at run time, or however you set environmental variables on your operating system. The only environmental variable that must be set is `POSTGRES_CONNECTION`, which contains your postgres login information.
| SERVER_LOGGER | No | false | Turn on Fastify's [error logger](https://www.fastify.io/docs/latest/Reference/Logging/)|
47
+
| SERVER_HOST | No | 0.0.0.0 | IP to [listen](https://www.fastify.io/docs/latest/Reference/Server/#listen) on, default is all |
48
+
| SERVER_PORT | No | 3000 | Port to [listen](https://www.fastify.io/docs/latest/Reference/Server/#listen) on |
49
+
| CACHE_PRIVACY | No | private |[Cache response directive](https://github.com/fastify/fastify-caching)|
50
+
| CACHE_EXPIRESIN | No | 3600 |[Max age in seconds](https://github.com/fastify/fastify-caching)|
51
+
| CACHE_SERVERCACHE | No | undefined | Max age in seconds for [shared cache](https://github.com/fastify/fastify-caching) (i.e. CDN) |
52
+
30
53
31
54
### Step 3: fire it up!
32
55
@@ -56,11 +79,13 @@ Fastify is written by some of the core Node developers, and it's awesome. A numb
56
79
57
80
All routes are stored in the `routes` folder and are automatically loaded on start. Check out the [routes readme](routes/README.md) for more information.
58
81
59
-
## Tips and tricks
82
+
## Tips and Tricks
60
83
61
84
### Database
62
85
63
-
Your Postgres login will need select rights to any tables or views it should be able to access. For security, it should _only_ have select rights unless you plan to specifically add a route that writes to a table.
86
+
Your Postgres login will need select rights to any tables or views it should be able to access. That includes the `geometry_columns` view for the `list_layers` end point to work.
87
+
88
+
For security, it should _only_ have select rights unless you plan to specifically add a route that writes to a table.
@@ -70,7 +95,7 @@ If a query parameter looks like it should be able to handle SQL functions, it pr
70
95
71
96
### Mapbox vector tiles
72
97
73
-
The `mvt` route serves Mapbox Vector Tiles. The layer name in the returned protobuf will be the same as the table name passed as input. Here's an example of using both `geojson` and `mvt` routes with Mapbox GL JS.
98
+
The `mvt` route serves Mapbox Vector Tiles. The layer name in the returned protobuf will be the same as the table name passed as input. Here's an example of using both `geojson` and `mvt` routes with MapLibre GL JS.
74
99
75
100
```javascript
76
101
map.on('load', function() {
@@ -108,23 +133,18 @@ map.on('load', function() {
108
133
109
134
### Rate Limiting
110
135
111
-
You can add rate limiting users by using the [fastify-rate-limit](https://github.com/fastify/fastify-rate-limit) plugin. This can be handy not only for regular connections but also to keep a wayward bot from eating your lunch.
136
+
You can add rate limiting users by using the [@fastify/rate-limit](https://github.com/fastify/fastify-rate-limit) plugin. This can be handy not only for regular connections but also to keep a wayward bot from eating your lunch.
- The master branch of Dirt is now optimized for PostGIS 3. Some functions will work on earlier versions, but some (geobuf, geojson, mvt in particular) will not. Use the `postgis2x` branch if you need to support PostGIS 2.
127
-
- If you modify code or add a route, dirt will not see it until dirt is restarted.
128
-
- The Dirt login needs read rights to the `geometry_columns` view for the `list_layers` service to work.
129
-
- You can override the db connection string with the environmental variable `POSTGRES_CONNECTION`.
130
-
- If you pass path parameters that have encoded slashes through an Apache proxy (i.e. `%2F`), Apache by default will reject those requests with a 404 (Docs: [AllowEncodedSlashes](https://httpd.apache.org/docs/2.4/mod/core.html#allowencodedslashes)). To fix that, add `AllowEncodedSlashes NoDecode` to the end of your httpd.conf.
150
+
If you modify code or add a route, dirt will not see it until dirt is restarted.
0 commit comments