maps: allow using MAPBOX_TOKEN env variable (#22721)
parent
b816b5b644
commit
0ba40954b9
|
@ -27,7 +27,8 @@
|
|||
#include "selfdrive/common/util.h"
|
||||
#include "cereal/messaging/messaging.h"
|
||||
|
||||
const QString MAPS_HOST = util::getenv("MAPS_HOST", "https://maps.comma.ai").c_str();
|
||||
const QString MAPBOX_TOKEN = util::getenv("MAPBOX_TOKEN").c_str();
|
||||
const QString MAPS_HOST = util::getenv("MAPS_HOST", MAPBOX_TOKEN.isEmpty() ? "https://maps.comma.ai" : "https://api.mapbox.com").c_str();
|
||||
|
||||
class MapInstructions : public QWidget {
|
||||
Q_OBJECT
|
||||
|
|
|
@ -79,11 +79,11 @@ void OnroadWindow::mousePressEvent(QMouseEvent* e) {
|
|||
void OnroadWindow::offroadTransition(bool offroad) {
|
||||
#ifdef ENABLE_MAPS
|
||||
if (!offroad) {
|
||||
if (map == nullptr && QUIState::ui_state.has_prime) {
|
||||
if (map == nullptr && (QUIState::ui_state.has_prime || !MAPBOX_TOKEN.isEmpty())) {
|
||||
QMapboxGLSettings settings;
|
||||
|
||||
// Valid for 4 weeks since we can't swap tokens on the fly
|
||||
QString token = CommaApi::create_jwt({}, 4 * 7 * 24 * 3600);
|
||||
QString token = MAPBOX_TOKEN.isEmpty() ? CommaApi::create_jwt({}, 4 * 7 * 24 * 3600) : MAPBOX_TOKEN;
|
||||
|
||||
if (!Hardware::PC()) {
|
||||
settings.setCacheDatabasePath("/data/mbgl-cache.db");
|
||||
|
|
Loading…
Reference in New Issue