reduce fragility on encryption key for data population
authorSteve Hackbarth <stephenhackbarth@gmail.com>
Mon, 14 Jul 2014 18:52:39 +0000 (14:52 -0400)
committerSteve Hackbarth <stephenhackbarth@gmail.com>
Mon, 14 Jul 2014 18:52:39 +0000 (14:52 -0400)
scripts/lib/build_database.js

index 8a3f525..d86e089 100644 (file)
@@ -223,9 +223,9 @@ var  async = require('async'),
         winston.info("Applying build to database " + spec.database);
         credsClone.database = spec.database;
         buildDatabaseUtil.sendToDatabase(allSql, credsClone, spec, function (err, res) {
-          if (spec.populateData) {
+          if (spec.populateData && creds.encryptionKeyFile) {
             var populateSql = "DO $$ XT.disableLocks = true; $$ language plv8;";
-            var encryptionKey = fs.readFileSync(path.join(__dirname, "../../node-datasource", creds.encryptionKeyFile), "utf8");
+            var encryptionKey = fs.readFileSync(path.resolve(__dirname, "../../node-datasource", creds.encryptionKeyFile), "utf8");
             var patches = require(path.join(__dirname, "../../enyo-client/database/source/populate_data")).patches;
             _.each(patches, function (patch) {
               patch.encryptionKey = encryptionKey;