From 3cd1308680643906bb5b98bbd94eac3d331803d5 Mon Sep 17 00:00:00 2001
From: Lloyd Hilaiel <lloyd@hilaiel.com>
Date: Fri, 3 Feb 2012 13:51:56 -0700
Subject: [PATCH] break common production config out into production.json,
 dev.json is dead now that dev is just an aws deployment

---
 config/aws.json        | 28 ++------------------
 config/dev.json        | 58 ------------------------------------------
 config/production.json | 57 +++++++++++++++++++++++++++++++++++++++++
 package.json           |  3 ++-
 4 files changed, 61 insertions(+), 85 deletions(-)
 delete mode 100644 config/dev.json
 create mode 100644 config/production.json

diff --git a/config/aws.json b/config/aws.json
index 398f5fe50..54f7ffba3 100644
--- a/config/aws.json
+++ b/config/aws.json
@@ -1,24 +1,9 @@
+// this is configuration specific to aws deployments
 {
-  "env": "production",
-  "bind_to": {
-    "host": "127.0.0.1"
-  },
-  "use_minified_resources": true,
-  "database": {
-    "driver": "mysql",
-    "user": "browserid",
-    "name": "browserid",
-    "create_schema": true
-  },
+  // disable statsd for aws
   "statsd": {
     "enabled": false
   },
-  "bcrypt_work_factor": 12,
-  "max_compute_processes": null,
-  "max_compute_duration": 10,
-  "disable_primary_support": false,
-  "enable_code_version": false,
-  "default_lang": "en-US",
   // for amazon deployments, enable it-CH which is the trigger language
   // for localization tests db-LB (which is a testing language where chars
   // are inverted and reversed), and en-US.
@@ -27,17 +12,8 @@
     "en-US", "it-CH", "db-LB"
   ],
   "locale_directory": "/home/app/code/locale",
-  "express_log_format": "default",
-  "email_to_console": false,
   "var_path": "/home/app/var",
 
-  "verifier": { "bind_to": { "port": 10000 } },
-  "verifier_url": "http://127.0.0.1:10000/verify",
-  "keysigner": { "bind_to": { "port": 10003 } },
-  "keysigner_url": "http://127.0.0.1:10003",
-  "dbwriter": { "bind_to": { "port": 10004 } },
-  "dbwriter_url": "http://127.0.0.1:10004",
-  "proxy": { "bind_to": { "port": 10006 } },
   "http_proxy": {
     "host": "127.0.0.1",
     "port": 10006
diff --git a/config/dev.json b/config/dev.json
deleted file mode 100644
index 22f4bb76a..000000000
--- a/config/dev.json
+++ /dev/null
@@ -1,58 +0,0 @@
-// this is the configuration for dev.diresworb.org.
-// only secrets are kep on the server, everything else
-// lives here
-{
-  "public_url": "https://dev.diresworb.org",
-  "env": "production",
-  "bind_to": {
-    "host": "127.0.0.1"
-  },
-  "use_minified_resources": true,
-  "database": {
-    "driver": "mysql",
-    "user": "browserid",
-    "name": "browserid",
-    "create_schema": true
-  },
-  "statsd": {
-    "enabled": false
-  },
-  "bcrypt_work_factor": 12,
-  "max_compute_processes": null,
-  "max_compute_duration": 10,
-  "disable_primary_support": false,
-  "enable_code_version": false,
-  "default_lang": "en-US",
-  "debug_lang": "it-CH",
-  "locale_directory": "/home/browserid/code/locale",
-  "supported_languages": [
-    "af", "ca", "cs", "da", "de", "el", "en-US", "eo", "es", "es-MX", "et", "eu",
-    "fi", "fr", "fy", "ga", "gd", "gl", "hr", "it", "ja", "lij", "lt",
-    "ml", "nl", "pl", "pt", "pt-BR", "rm", "ro", "ru", "sk", "sl", "son",
-    "sq", "sr", "tr", "zh-CN", "zh-TW",
-    "it-CH", "db-LB"
-  ],
-  "express_log_format": "default",
-  "email_to_console": false,
-  "var_path": "/home/browserid/var",
-
-  "verifier": { "bind_to": { "port": 62800 } },
-  "verifier_url": "http://127.0.0.1:62800",
-  "keysigner": { "bind_to": { "port": 62600 } },
-  "keysigner_url": "http://127.0.0.1:62600",
-  "dbwriter": { "bind_to": { "port": 62900 } },
-  "dbwriter_url": "http://127.0.0.1:62900",
-/* XXX: We should really enable the outbound http proxy in dev!
-  "proxy": { "bind_to": { "port": 10006 } },
-  "http_proxy": {
-    "host": "127.0.0.1",
-    "port": 10006
-  },
-*/
-  "browserid": { "bind_to": { "port": 62700 } },
-
-  "smtp": {
-    "host": "smtp.socketlabs.com"
-    // username and password live on the server
-  }
-}
diff --git a/config/production.json b/config/production.json
new file mode 100644
index 000000000..0bcce3af0
--- /dev/null
+++ b/config/production.json
@@ -0,0 +1,57 @@
+// production.js is the common base configuration for
+// all hosted deployments (non-local)
+{
+  "env": "production",
+  "bind_to": {
+    "host": "127.0.0.1"
+  },
+  "use_minified_resources": true,
+  "database": {
+    "driver": "mysql",
+    "user": "browserid",
+    "name": "browserid",
+    "create_schema": true
+  },
+  "statsd": {
+    "enabled": true
+  },
+  "bcrypt_work_factor": 12,
+  "max_compute_processes": null,
+  "max_compute_duration": 10,
+  "disable_primary_support": false,
+  "enable_code_version": false,
+  "default_lang": "en-US",
+  // supported_languages should be overridded with what is appropriate for the
+  // deployment.  That is environment dependent:
+  //  * in l10 preview env it's all available locales
+  //  * in staging or dev envs it depends, but should include at least
+  //    testing locales:  "it-CH", "db-LB"
+  //  * in production it's reviews locales that have been signed off
+  "supported_languages": [
+    "en-US"
+  ],
+  "debug_lang": "it-CH",
+  // locale directory should be overridden
+  "locale_directory": "/home/app/code/locale",
+  "express_log_format": "default",
+  "email_to_console": false,
+  // var path should be overridded
+  // "var_path": "xxx",
+
+  // this is daemon specific configuration to bind the
+  // ports we've traditionally bound different daemons to,
+  // may be overridden if desired
+  "verifier": { "bind_to": { "port": 62800 } },
+  "verifier_url": "http://127.0.0.1:62800",
+  "keysigner": { "bind_to": { "port": 62600 } },
+  "keysigner_url": "http://127.0.0.1:62600",
+  "dbwriter": { "bind_to": { "port": 62900 } },
+  "dbwriter_url": "http://127.0.0.1:62900",
+  "browserid": { "bind_to": { "port": 62700 } }
+
+  // http_proxy should be overridded per env
+  //"http_proxy": {
+  //  "host": "127.0.0.1",
+  //  "port": 10006
+  //},
+}
diff --git a/package.json b/package.json
index df9420496..5a498e939 100644
--- a/package.json
+++ b/package.json
@@ -33,7 +33,8 @@
     "devDependencies": {
         "xml2json": "0.2.4",
         "vows": "0.5.13",
-        "aws-lib": "0.0.5"
+        "aws-lib": "0.0.5",
+        "irc": "0.3.3"
     },
     "scripts": {
         "postinstall": "./scripts/generate_ephemeral_keys.sh",
-- 
GitLab