Files
iD/config/id.js
2025-06-19 18:16:57 -06:00

65 lines
2.2 KiB
JavaScript

/* eslint-disable no-undef */
// cdns for external data packages
const presetsCdnUrl = ENV__ID_PRESETS_CDN_URL
|| 'https://id-tagging-schema.deflock.me/';
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 = {
live: {
url: 'https://www.openstreetmap.org',
apiUrl: 'https://api.openstreetmap.org',
client_id: 'JHvon_-Q5ez357REB4jY7pnvXmyW4MyabXWVXdC_H7A'
},
dev: {
url: 'https://api06.dev.openstreetmap.org',
client_id: 'BpM31KdNZabpOoHJnoQJmRWIhwdpVy0oZA0tZdKoXg8'
}
};
const osmApiConnections = [];
if (ENV__ID_API_CONNECTION_URL !== null &&
ENV__ID_API_CONNECTION_CLIENT_ID !== null) {
// user specified API Oauth2 connection details
// see https://wiki.openstreetmap.org/wiki/OAuth#OAuth_2.0_2
osmApiConnections.push({
url: ENV__ID_API_CONNECTION_URL,
apiUrl: ENV__ID_API_CONNECTION_API_URL || ENV__ID_API_CONNECTION_URL,
client_id: ENV__ID_API_CONNECTION_CLIENT_ID
});
} else if (ENV__ID_API_CONNECTION !== null &&
defaultOsmApiConnections[ENV__ID_API_CONNECTION] !== undefined) {
// if environment variable ID_API_CONNECTION is either "live" or "dev":
// only allow to connect to the respective OSM server
osmApiConnections.push(defaultOsmApiConnections[ENV__ID_API_CONNECTION]);
} else {
// offer both "live" and "dev" servers by default
osmApiConnections.push(defaultOsmApiConnections.live);
osmApiConnections.push(defaultOsmApiConnections.dev);
}
// auxiliary OSM services
const taginfoApiUrl = ENV__ID_TAGINFO_API_URL
|| 'https://taginfo.openstreetmap.org/api/4/';
const nominatimApiUrl = ENV__ID_NOMINATIM_API_URL
|| 'https://nominatim.openstreetmap.org/';
// support/donation message on upload success screen
const showDonationMessage = ENV__ID_SHOW_DONATION_MESSAGE !== 'false';
export {
presetsCdnUrl,
ociCdnUrl,
wmfSitematrixCdnUrl,
nsiCdnUrl,
osmApiConnections,
taginfoApiUrl,
nominatimApiUrl,
showDonationMessage
};