From 9d75a9a706937c93300fd35154021a84e775d242 Mon Sep 17 00:00:00 2001 From: Ossi Salmi Date: Mon, 30 Nov 2015 12:08:28 +0000 Subject: [PATCH] abusesa: Generate Live config with JSON.generate, add mapurl parameter --- abusesa/manifests/live.pp | 3 ++- abusesa/templates/live/config.json.erb | 20 +++++++++++++++++--- 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/abusesa/manifests/live.pp b/abusesa/manifests/live.pp index 7c72d79..1384592 100644 --- a/abusesa/manifests/live.pp +++ b/abusesa/manifests/live.pp @@ -17,6 +17,7 @@ class abusesa::live( $authurl='/collab/?action=authcredentials', $boshurl='/bosh/', + $mapurl=undef, $config=undef, $webhosts=undef, ) { @@ -106,7 +107,7 @@ define abusesa::live::configwebhost($htdocs) { mode => '0644', owner => 'root', group => 'root', - content => "RedirectMatch permanent /vsroom/overview/(index\.html)? /abusesa/live/\n", + content => "RedirectMatch permanent /vsroom/overview/(index\\.html)? /abusesa/live/\n", } } diff --git a/abusesa/templates/live/config.json.erb b/abusesa/templates/live/config.json.erb index 10aa204..4bf7994 100644 --- a/abusesa/templates/live/config.json.erb +++ b/abusesa/templates/live/config.json.erb @@ -1,4 +1,18 @@ -{ - "authUrl": "<%= @authurl %>", - "boshUrl": "<%= @boshurl %>" +<% +require 'json' + +config = { + 'authUrl' => @authurl, + 'boshUrl' => @boshurl, } + +if @mapurl + config['viewPlugins'] = [{ + 'id' => 'map', + 'name' => 'Map', + 'type' => 'PolymapsView', + 'settings' => { 'mapUrl' => @mapurl }, + }] +end +-%> +<%= JSON.generate(config) %>