summaryrefslogtreecommitdiff
path: root/linux
diff options
context:
space:
mode:
authorKonstantin Käfer <mail@kkaefer.com>2014-07-10 11:27:03 -0700
committerKonstantin Käfer <mail@kkaefer.com>2014-07-10 11:27:03 -0700
commit0d7b3462e9e72190d41341e7da243d6f0732e4ef (patch)
treeeabad69a956a410b2951977281259dd631a32acb /linux
parent795496053b828b9f536124066e70f492780939d1 (diff)
downloadqtlocation-mapboxgl-0d7b3462e9e72190d41341e7da243d6f0732e4ef.tar.gz
read access token from environment
Diffstat (limited to 'linux')
-rw-r--r--linux/main.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/linux/main.cpp b/linux/main.cpp
index eee7147503..889a246c29 100644
--- a/linux/main.cpp
+++ b/linux/main.cpp
@@ -8,7 +8,6 @@
#include "../common/settings_json.hpp"
#include "../common/glfw_view.hpp"
-#include "../access_token.hpp"
GLFWView *view = nullptr;
@@ -61,8 +60,15 @@ int main(int argc, char *argv[]) {
map.setAngle(settings.angle);
map.setDebug(settings.debug);
+ // Set access token if present
+ const char *token = getenv("MAPBOX_ACCESS_TOKEN");
+ if (token == nullptr) {
+ fprintf(stderr, "[WARNING] no access token set. mapbox.com tiles won't work.\n");
+ } else {
+ map.setAccessToken(std::string(token));
+ }
+
// Load style
- map.setAccessToken(mapbox_access_token);
map.setStyleJSON(stylejson.str());
int ret = view->run();