diff options
Diffstat (limited to 'examples/location/places/main.cpp')
-rw-r--r-- | examples/location/places/main.cpp | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/examples/location/places/main.cpp b/examples/location/places/main.cpp index 8c3b64ed..a30fb857 100644 --- a/examples/location/places/main.cpp +++ b/examples/location/places/main.cpp @@ -90,6 +90,24 @@ int main(int argc, char *argv[]) QVariantMap parameters; QStringList args(QCoreApplication::arguments()); + // Fetch tokens from the environment, if present + const QByteArray mapboxMapID = qgetenv("MAPBOX_MAP_ID"); + const QByteArray mapboxAccessToken = qgetenv("MAPBOX_ACCESS_TOKEN"); + const QByteArray hereAppID = qgetenv("HERE_APP_ID"); + const QByteArray hereToken = qgetenv("HERE_TOKEN"); + const QByteArray esriToken = qgetenv("ESRI_TOKEN"); + + if (!mapboxMapID.isEmpty()) + parameters["mapbox.map_id"] = QString::fromLocal8Bit(mapboxMapID); + if (!mapboxAccessToken.isEmpty()) + parameters["mapbox.access_token"] = QString::fromLocal8Bit(mapboxAccessToken); + if (!hereAppID.isEmpty()) + parameters["here.app_id"] = QString::fromLocal8Bit(hereAppID); + if (!hereToken.isEmpty()) + parameters["here.token"] = QString::fromLocal8Bit(hereToken); + if (!esriToken.isEmpty()) + parameters["esri.token"] = QString::fromLocal8Bit(esriToken); + if (parseArgs(args, parameters)) return 0; |