Commit f135b85d authored by Mike Jones's avatar Mike Jones 🌶

Use map access token, use base_url from config

parent aeb8f8eb
......@@ -57,8 +57,10 @@ my $beer_cache = Mojo::Cache->new(max_keys => 50);
get '/' => sub {
my $c = shift;
$c->stash(access_token => $config->{map}->{token});
$c->stash(attrib => $config->{map}->{attrib});
$c->stash({
access_token => $config->{map}->{token},
base_url => $config->{base_url},
});
return $c->render(template => 'index');
};
......
# base_url should not contain a scheme
base_url: '127.0.0.1:3000'
map:
token: 'changeme'
untappd:
......
......@@ -5,7 +5,7 @@ var markers = [];
// Set up the map
L.tileLayer('https://api.tiles.mapbox.com/v4/{id}/{z}/{x}/{y}.png?access_token={accessToken}', {
attribution: 'Map data &copy; <a href="https://www.openstreetmap.org/">OpenStreetMap</a> contributors, <a href="https://creativecommons.org/licenses/by-sa/2.0/">CC-BY-SA</a>, Imagery © <a href="https://www.mapbox.com/">Mapbox</a>',
token: 'pk.eyJ1IjoibjdzdCIsImEiOiJjamhxNnRjZXMzbjE0M2RvNm4wcGVxcm9kIn0.J9LDNdB8D6V9ANlH8qS7xQ',
token: accessToken,
maxZoom: 18,
id: 'mapbox.streets',
accessToken: accessToken,
......@@ -59,7 +59,7 @@ function clear() {
* @return void
*/
function loadBeersWs(username) {
var ws = new WebSocket('ws://web01.host1.lab.netsplit.uk:3000/beers/ws/' + username);
var ws = new WebSocket('ws://' + base_url + '/beers/ws/' + username);
ws.onopen = function(evt) {
console.log('Starting query for ' + username);
......
......@@ -85,7 +85,8 @@
></script>
<script type="text/javascript">
var accessToken = "<%= $access_token %>";
var accessToken = "<%= $access_token %>",
base_url = "<%= $base_url %>";
</script>
<script src="js/aletrail.js"></script>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment