From adf1124e701696a26049cea7b76d9f529d4de998 Mon Sep 17 00:00:00 2001 From: Sandro Santilli Date: Tue, 18 Sep 2012 17:36:20 +0200 Subject: [PATCH] Add script to drop the XML element from all redis stored map styles WARNING: as of grainstore-0.6.1 a map style with no XML will break the application, so do _not_ run this script unless you're sure about what you're doing. --- tools/reset_styles | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100755 tools/reset_styles diff --git a/tools/reset_styles b/tools/reset_styles new file mode 100755 index 00000000..13cace58 --- /dev/null +++ b/tools/reset_styles @@ -0,0 +1,31 @@ +#!/usr/bin/env node + +// Reset redis-stored XML styles so that they are regenerated +// from CartoCSS on next tile request + +var redis = require('redis') + +var REDIS_PORT = 6379; // TODO: make a parameter + +var dbnum = 0; + +var client = redis.createClient(REDIS_PORT, 'localhost'); +client.on('connect', function() { + client.select(dbnum); + client.keys('map_style|*', function(err, matches) { + for (var i=0; i