Skip to content

Commit

Permalink
Merge pull request #284 from sensebox/netlify
Browse files Browse the repository at this point in the history
Netlify compatibility
  • Loading branch information
mpfeil authored Oct 24, 2018
2 parents e41a400 + 5f7e567 commit b9dd69e
Show file tree
Hide file tree
Showing 2 changed files with 90 additions and 1 deletion.
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,16 @@ This repository contains the code of the openSenseMap frontend running at [https

Originally, this frontend has been built as part of the bachelor thesis of [@mpfeil](https://github.com/mpfeil) at the ifgi (Institute for Geoinformatics, WWU Münster) and is currently maintained by [@mpfeil](https://github.com/mpfeil).

The easiest way to get up and running with your own copy is clicking the Deploy to Netlify button below. It will clone the repository into your own account, and deploy the site to Netlify. It is going to ask for `Maptiles url` and `API endpoint`. Please use the default values listed under [configuration](#Configuration) or use your own.

[![Deploy to Netlify](https://www.netlify.com/img/deploy/button.svg)](https://app.netlify.com/start/deploy?repository=https://github.com/sensebox/openSenseMap)

## Configuration
You can configure the API endpoint and/or map tiles using the following environmental variables:

| ENV | Default value |
| --------- | ----------------- |
| OPENSENSEMAP_API_URL | https://api.osem.vo1d.space |
| OPENSENSEMAP_API_URL | https://api.testing.opensensemap.org |
| OPENSENSEMAP_MAPTILES_URL | http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png |

You can set them in your `terminal` or change the default values in the [Gruntfile](https://github.com/sensebox/openSenseMap/blob/development/Gruntfile.js#L24).
Expand Down
85 changes: 85 additions & 0 deletions netlify.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
[build]
publish = "dist/"
command = "grunt build --target=build"

[context.branch-deploy]
environment = { OPENSENSEMAP_MAPTILES_URL = "http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png", OPENSENSEMAP_API_URL = "https://api.testing.opensensemap.org" }

[[headers]]
for = "/*"

[headers.values]
X-Frame-Options = "DENY"
X-XSS-Protection = "1; mode=block"
X-Content-Type-Options = "nosniff"
Cache-Control = "public, max-age: 300"

[[headers]]
for = "/scripts"

[headers.values]
Expires = "Thu, 31 Dec 2037 23:55:55 GMT"
Cache-Control = "public"

[[headers]]
for = "/styles"

[headers.values]
Expires = "Thu, 31 Dec 2037 23:55:55 GMT"
Cache-Control = "public"

[[headers]]
for = "/fonts"

[headers.values]
Expires = "Thu, 31 Dec 2037 23:55:55 GMT"
Cache-Control = "public"

[[redirects]]
from="/explore/*"
to="/"
status=200

[[redirects]]
from="/account"
to="/"
status=200

[[redirects]]
from="/interpolation"
to="/"
status=200

[[redirects]]
from="/filter"
to="/"
status=200

[[redirects]]
from="/download"
to="/"
status=200

[[redirects]]
from="/register"
to="/"
status=200

[[redirects]]
from="/about"
to="/"
status=200

[[redirects]]
from="/imprint"
to="/"
status=200

[[redirects]]
from="/privacy"
to="/"
status=200

[template.environment]
OPENSENSEMAP_MAPTILES_URL = "Maptiles url"
OPENSENSEMAP_API_URL = "API endpoint"

0 comments on commit b9dd69e

Please sign in to comment.