mirror of
https://github.com/FoggedLens/iD.git
synced 2026-02-13 01:02:58 +00:00
also make other CDNs and services configurable via env vars
This commit is contained in:
9
API.md
9
API.md
@@ -106,9 +106,14 @@ In addition, the following parameters are available as **URL query parameters**:
|
||||
|
||||
Environment variables or a dotenv file can be used to configure certain aspects of iD at build time.
|
||||
|
||||
* __`ID_API_CONNECTION_URL`__, __`ID_API_CONNECTION_CLIENT_ID`__, __`ID_API_CONNECTION_CLIENT_SECRET`__ - Custom [Oauth2](https://wiki.openstreetmap.org/wiki/OAuth#OAuth_2.0_2) connection details to an OSM API server.
|
||||
* __`ID_API_CONNECTION`__ - Either `live` or `dev`, if only either one should be made offered for editing.
|
||||
* __`ID_PRESETS_CDN_URL`__ - The URL where iD should fetch it's tagging presets from. Needs to point to a CORS enabled web server which is serving the `package.json` and `dist` folder of a repository built on [`@ideditor/schema-builder`](https://github.com/ideditor/schema-builder).
|
||||
* __`ID_API_CONNECTION_URL`__, __`ID_API_CONNECTION_CLIENT_ID`__, __`ID_API_CONNECTION_CLIENT_SECRET`__ - custom [Oauth2](https://wiki.openstreetmap.org/wiki/OAuth#OAuth_2.0_2) connection details to an OSM API server
|
||||
* __`ID_API_CONNECTION`__ - either `live` or `dev`, if only either one should be made offered for editing
|
||||
* __`ENV__ID_OCI_CDN_URL`__ - URL to a hosted version of the [osm-community-index](https://github.com/osmlab/osm-community-index)
|
||||
* __`ENV__ID_NSI_CDN_URL`__ - URL to a hosted version of the [name-suggestion-index](https://github.com/osmlab/name-suggestion-index)
|
||||
* __`ENV__ID_WMF_SITEMATRIX_CDN_URL`__ - URL to a hosted version of the [wmf-sitematrix](https://github.com/osmlab/wmf-sitematrix)
|
||||
* __`ID_TAGINFO_API_URL`__ - URL to a [taginfo](https://wiki.openstreetmap.org/wiki/Taginfo) service.
|
||||
* __`ID_NOMINATIM_API_URL`__ - URL to a [nominatim](https://wiki.openstreetmap.org/wiki/Nominatim) geocoding service.
|
||||
|
||||
## CSS selectors
|
||||
|
||||
|
||||
@@ -3,10 +3,17 @@ import dotenv from 'dotenv';
|
||||
dotenv.config();
|
||||
const envs = {
|
||||
ENV__ID_PRESETS_CDN_URL: JSON.stringify(process.env.ID_PRESETS_CDN_URL || null),
|
||||
ENV__ID_OCI_CDN_URL: JSON.stringify(process.env.ID_OCI_CDN_URL || null),
|
||||
ENV__ID_NSI_CDN_URL: JSON.stringify(process.env.ID_NSI_CDN_URL || null),
|
||||
ENV__ID_WMF_SITEMATRIX_CDN_URL: JSON.stringify(process.env.ID_WMF_SITEMATRIX_CDN_URL || null),
|
||||
|
||||
ENV__ID_API_CONNECTION_URL: JSON.stringify(process.env.ID_API_CONNECTION_URL || null),
|
||||
ENV__ID_API_CONNECTION_CLIENT_ID: JSON.stringify(process.env.ID_API_CONNECTION_CLIENT_ID || null),
|
||||
ENV__ID_API_CONNECTION_CLIENT_SECRET: JSON.stringify(process.env.ID_API_CONNECTION_CLIENT_SECRET || null),
|
||||
ENV__ID_API_CONNECTION: JSON.stringify(process.env.ID_API_CONNECTION || null)
|
||||
ENV__ID_API_CONNECTION: JSON.stringify(process.env.ID_API_CONNECTION || null),
|
||||
|
||||
ENV__ID_TAGINFO_API_URL: JSON.stringify(process.env.ENV__ID_TAGINFO_API_URL || null),
|
||||
ENV__ID_NOMINATIM_API_URL: JSON.stringify(process.env.ENV__ID_NOMINATIM_API_URL || null),
|
||||
}
|
||||
|
||||
export default envs;
|
||||
|
||||
20
config/id.js
20
config/id.js
@@ -1,10 +1,12 @@
|
||||
//import * as env from 'env';
|
||||
|
||||
// cdns for external data packages
|
||||
const presetsCdnUrl = ENV__ID_PRESETS_CDN_URL || 'https://cdn.jsdelivr.net/npm/@openstreetmap/id-tagging-schema@{presets_version}/';
|
||||
const ociCdnUrl = 'https://cdn.jsdelivr.net/npm/osm-community-index@{version}/';
|
||||
const wmfSitematrixCdnUrl = 'https://cdn.jsdelivr.net/npm/wmf-sitematrix@{version}/';
|
||||
const nsiCdnUrl = 'https://cdn.jsdelivr.net/npm/name-suggestion-index@{version}/';
|
||||
const presetsCdnUrl = ENV__ID_PRESETS_CDN_URL
|
||||
|| 'https://cdn.jsdelivr.net/npm/@openstreetmap/id-tagging-schema@{presets_version}/';
|
||||
const ociCdnUrl = ENV__ID_OCI_CDN_URL
|
||||
|| 'https://cdn.jsdelivr.net/npm/osm-community-index@{version}/';
|
||||
const wmfSitematrixCdnUrl = ENV__ID_WMF_SITEMATRIX_CDN_URL
|
||||
|| 'https://cdn.jsdelivr.net/npm/wmf-sitematrix@{version}/';
|
||||
const nsiCdnUrl = ENV__ID_NSI_CDN_URL
|
||||
|| 'https://cdn.jsdelivr.net/npm/name-suggestion-index@{version}/';
|
||||
|
||||
// api urls and settings
|
||||
const defaultOsmApiConnections = {
|
||||
@@ -42,8 +44,10 @@ if (ENV__ID_API_CONNECTION_URL !== null &&
|
||||
}
|
||||
|
||||
// auxiliary OSM services
|
||||
const taginfoApiUrl = 'https://taginfo.openstreetmap.org/api/4/';
|
||||
const nominatimApiUrl = 'https://nominatim.openstreetmap.org/';
|
||||
const taginfoApiUrl = ENV__ID_TAGINFO_API_URL
|
||||
|| 'https://taginfo.openstreetmap.org/api/4/';
|
||||
const nominatimApiUrl = ENV__ID_NOMINATIM_API_URL
|
||||
|| 'https://nominatim.openstreetmap.org/';
|
||||
|
||||
export {
|
||||
presetsCdnUrl,
|
||||
|
||||
Reference in New Issue
Block a user