Created
September 10, 2014 23:58
-
-
Save nota-ja/32b828d8906d9d45e23a to your computer and use it in GitHub Desktop.
Changes to make etherpad-lite-cf run with DB on Cloud Foundry
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/etherpad-lite-cf-org/node_modules/ep_etherpad-lite/node/utils/Settings.js b/etherpad-lite-cf/node_modules/ep_etherpad-lite/node/utils/Settings.js | |
index 9bfcae4..20794b5 100644 | |
--- a/etherpad-lite-cf-org/node_modules/ep_etherpad-lite/node/utils/Settings.js | |
+++ b/etherpad-lite-cf/node_modules/ep_etherpad-lite/node/utils/Settings.js | |
@@ -222,7 +222,28 @@ exports.reloadSettings = function reloadSettings() { | |
console.warn("You need to set a sessionKey value in settings.json, this will allow your users to reconnect to your Etherpad Instance if your instance restarts"); | |
} | |
+ if (process.env.DATABASE_URL) { | |
+ var parseDbUrl = require("parse-database-url"); | |
+ var dbConfig = parseDbUrl(process.env.DATABASE_URL) | |
+ | |
+ /* | |
+ * The Type of the database | |
+ */ | |
+ exports.dbType = dbConfig.driver; | |
+ /** | |
+ * This setting is passed with dbType to ueberDB to set up the database | |
+ */ | |
+ exports.dbSettings = { | |
+ "user" : dbConfig.user, | |
+ "password": dbConfig.password, | |
+ "host" : dbConfig.host, | |
+ "port" : dbConfig.port, | |
+ "database": dbConfig.database | |
+ } | |
+ } | |
+ | |
if(exports.dbType === "dirty"){ | |
+ console.info("DATABASE_URL is '" + process.env.DATABASE_URL + "'") | |
console.warn("DirtyDB is used. This is fine for testing but not recommended for production."); | |
} | |
}; | |
diff --git a/etherpad-lite-cf-org/package.json b/etherpad-lite-cf/package.json | |
index a8b0fc7..d7779dd 100644 | |
--- a/etherpad-lite-cf-org/package.json | |
+++ b/etherpad-lite-cf/package.json | |
@@ -41,7 +41,8 @@ | |
"channels" : "0.0.x", | |
"jsonminify" : "0.2.2", | |
"measured" : "0.1.3", | |
- "hashish" : "0.0.4" | |
+ "hashish" : "0.0.4", | |
+ "parse-database-url" : "*" | |
}, | |
"bin": { "etherpad-lite": "./node/server.js" }, | |
"devDependencies": { | |
diff --git a/etherpad-lite-cf/var/dirty.db b/etherpad-lite-cf/var/dirty.db | |
new file mode 100644 | |
index 0000000..e69de29 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment