From 3b5804237a7defbe863bf49315f53bcc133b0889 Mon Sep 17 00:00:00 2001
From: Erick Hitter <services@ethitter.com>
Date: Tue, 27 Dec 2016 11:09:04 -0800
Subject: [PATCH] Version config to support breaking changes currently in the
 `develop` branch

Fixes #2
---
 config-sample.json | 3 ++-
 index.js           | 8 +++++++-
 package.json       | 2 +-
 3 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/config-sample.json b/config-sample.json
index 78c9585..0127392 100644
--- a/config-sample.json
+++ b/config-sample.json
@@ -23,5 +23,6 @@
         "entity_action": ""
       }
     }
-  }
+  },
+  "config_version": 2
 }
diff --git a/index.js b/index.js
index a402f1a..68d1b55 100644
--- a/index.js
+++ b/index.js
@@ -11,7 +11,13 @@ var request               = require( 'request' );
 /**
  * CONFIGURATION & SETUP
  */
-var config               = require( './config.json' );
+var config = require( './config.json' );
+
+if ( 'undefined' === typeof config.config_version || config.config_version < 2 ) {
+    console.error( 'Configuration is for v0.1.0 and must be updated to work with this release. Exiting!' );
+    process.exit();
+}
+
 var homeAssistantApiBase = config.home_assistant_proto + '://' + config.home_assistant_host + ':' + config.home_assistant_port + '/api/';
 var client               = new FlicClient( config.flicd_ip, config.flicd_port );
 
diff --git a/package.json b/package.json
index bc98c5c..38b71f7 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
 {
   "name": "flic-button-home-assistant-controller",
-  "version": "0.1.0",
+  "version": "0.2.0",
   "description": "Control Home Assistant entities with Flic buttons",
   "author": "Erick Hitter <contact@ethitter.com>",
   "license": "GPL-2.0+",
-- 
GitLab