Commentary on JSON location and structure changes.
Original diff can be found at phalanges.diff and can be applied to a git checkout of phalanges using awk and patch:
$ cat phalanges.diff | awk '!/\#/' | patch -p1
commit 62244ca00d56b4430851f977c9651e87dd4d000d
Author: Matt Croydon <matt@lawrence.com>
Date: Sat Feb 26 16:22:27 2011 -0600
Change user JSON location and structure.
diff --git a/config/phalanges.conf b/config/phalanges.conf
index 5410d02..5c2a373 100644
--- a/config/phalanges.conf
+++ b/config/phalanges.conf
@@ -7,4 +7,4 @@ log {
host = "127.0.0.1"
port = 79
admin_port = 9999
I wanted to be a little more explicit about this being a map and not a list.
-users_json = "conf/users.json"
+users_json = "config/user_map.json"
diff --git a/config/user_map.json b/config/user_map.json
new file mode 100644
index 0000000..073dfd6
--- /dev/null
+++ b/config/user_map.json
@@ -0,0 +1,12 @@
The new format is a JSON object (dictionary/hash) rather than a JSON list. This allowed me to change how I looked up users and changed the logic from "iterate over this loop" to "look up this user based on username".
+{
+ "mcroydon":
+ {
+ "name": "Matt Croydon",
+ "plan": "Implement archaic protocols."
+ },
+ "robot":
+ {
+ "name": "A Robot",
+ "plan": "Doing the things a robot does."
+ }
+}
diff --git a/config/users.json b/config/users.json
deleted file mode 100644
index b1f682b..0000000
--- a/config/users.json
+++ /dev/null
@@ -1,12 +0,0 @@
The old format was great for getting me off the ground, but I don't miss it.
-[
- {
- "username" : "mcroydon",
- "name" : "Matt Croydon",
- "plan" : "Implement archaic protocols."
- },
- {
- "username" : "robot",
- "name" : "A. Robot",
- "plan" : "Doing the things a robot does."
- }
-]
\ No newline at end of file