Newer
Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
# Tiles Proxy
TilesProxy: a cache proxy for tiles.
The aim of this little server is to act as a proxy for geographic tiles servers in order to limit calls to their services from our web applications.
Supported standards for tiles:
- [OGC](https://www.ogc.org/) WMTS: [OpenGIS Web Map Tile Service](https://www.ogc.org/standard/wmts/)
- XYZ (aka Slippy Map Tilenames): the de facto OpenStreetMap standard
Configuration of origin tiles servers is done in a TOML file.
See [`tiles-proxy.toml`](tiles-proxy.toml) for example.
To enable browser caching, HTTP headers are added: [ETag](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/ETag) and [Cache-Control](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Cache-Control).
[CORS headers](https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS) are also added to enable canvas export (eg.: in OpenLayers) from browser.
## Getting started
### Install Rust
*Tiles Proxy* uses the web framework for Rust: [Rocket](https://rocket.rs/).
Because of this, we'll need a recent release of Rust to run Rocket applications. If you already have a working installation of the latest Rust compiler, feel free to skip to the next section.
First, install `rustup`.
```sh
# install rustup, Proceed with standard installation
curl https://sh.rustup.rs -sSf | sh
# read the output to configure your shell
```
Once `rustup` is installed, ensure the latest toolchain is installed by running the command:
```sh
rustup default stable
```
Add pkg-config to compile openssl-sys
```sh
sudo apt install pkg-config
```
### Development
Format code with
```sh
cargo fmt --
```
Test with
```sh
cargo test
```
Use a linter with
```sh
cargo clippy
```

Olivier Maury
committed
### Commits

Olivier Maury
committed
Commit messages must follow the [Conventional Commits](https://www.conventionalcommits.org/) specification, a lightweight convention to write the commit message text.

Olivier Maury
committed
### Configure VSCodium / VS Code
- [VSCodium](https://vscodium.com/)
- [Visual Studio Code](https://code.visualstudio.com/)
Recommended extensions:
- Even Better TOML (`ext install tamasfe.even-better-toml`):
Fully-featured TOML support
https://marketplace.visualstudio.com/items?itemName=tamasfe.even-better-toml

Olivier Maury
committed
- rust-analyzer (`ext install rust-lang.rust-analyzer`):
Rust language support for Visual Studio Code
https://marketplace.visualstudio.com/items?itemName=rust-lang.rust-analyzer

Olivier Maury
committed
- Conventional Commits (`ext install vivaxy.vscode-conventional-commits`)
Conventional Commits for VSCode
https://marketplace.visualstudio.com/items?itemName=vivaxy.vscode-conventional-commits