summaryrefslogtreecommitdiff
path: root/provider_base
diff options
context:
space:
mode:
authorelijah <elijah@riseup.net>2013-04-30 14:25:45 -0700
committerelijah <elijah@riseup.net>2013-04-30 14:25:45 -0700
commitc8e427c39285a0ac8750c1b9bbf247533bbce519 (patch)
tree1a9472ec6c15e8c79df9ce01196fdb17906b18a0 /provider_base
parentb54161a12561c5983f6bc5215f764a1f46a4bd1f (diff)
added soledad-service.json
Diffstat (limited to 'provider_base')
-rw-r--r--provider_base/common.json3
-rw-r--r--provider_base/files/service-definitions/v1/eip-service.json.erb2
-rw-r--r--provider_base/files/service-definitions/v1/soledad-service.json.erb29
-rw-r--r--provider_base/services/soledad.json6
-rw-r--r--provider_base/services/webapp.json3
5 files changed, 40 insertions, 3 deletions
diff --git a/provider_base/common.json b/provider_base/common.json
index dc59b88e..e89fce7e 100644
--- a/provider_base/common.json
+++ b/provider_base/common.json
@@ -29,5 +29,6 @@
"development": {
"site_config": true
},
- "name": "common"
+ "name": "common",
+ "location": null
}
diff --git a/provider_base/files/service-definitions/v1/eip-service.json.erb b/provider_base/files/service-definitions/v1/eip-service.json.erb
index ca42bef5..9ee489de 100644
--- a/provider_base/files/service-definitions/v1/eip-service.json.erb
+++ b/provider_base/files/service-definitions/v1/eip-service.json.erb
@@ -14,7 +14,7 @@
gateway["host"] = node.domain.full
gateway["ip_address"] = options[:ip]
gateway["capabilities"]["limited"] = options[:limited]
- if node.location
+ if node['location']
location_name = underscore(node.location.name)
gateway["location"] = location_name
locations[location_name] ||= node.location
diff --git a/provider_base/files/service-definitions/v1/soledad-service.json.erb b/provider_base/files/service-definitions/v1/soledad-service.json.erb
new file mode 100644
index 00000000..4d345930
--- /dev/null
+++ b/provider_base/files/service-definitions/v1/soledad-service.json.erb
@@ -0,0 +1,29 @@
+<%=
+ def underscore(words)
+ words = words.to_s.dup
+ words.downcase!
+ words.gsub! /[^a-z]/, '_'
+ words
+ end
+
+ hsh = {}
+ hsh["serial"] = 1
+ hsh["version"] = 1
+ locations = {}
+ hosts = {}
+ nodes_like_me[:services => 'soledad'].each_node do |node|
+ host = {}
+ host["hostname"] = node.domain.full
+ host["ip_address"] = node.ip_address
+ host["port"] = node.soledad.port
+ if node['location']
+ location_name = underscore(node.location.name)
+ host["location"] = location_name
+ locations[location_name] ||= node.location
+ end
+ hosts[node.name] = host
+ end
+ hsh["hosts"] = hosts
+ hsh["locations"] = locations
+ generate_json hsh
+%> \ No newline at end of file
diff --git a/provider_base/services/soledad.json b/provider_base/services/soledad.json
new file mode 100644
index 00000000..10657563
--- /dev/null
+++ b/provider_base/services/soledad.json
@@ -0,0 +1,6 @@
+{
+ "service_type": "public_service",
+ "soledad": {
+ "port": 1111
+ }
+} \ No newline at end of file
diff --git a/provider_base/services/webapp.json b/provider_base/services/webapp.json
index e4926ba7..4b2f7c26 100644
--- a/provider_base/services/webapp.json
+++ b/provider_base/services/webapp.json
@@ -22,7 +22,8 @@
},
"definition_files": {
"provider": "= file :provider_json_template",
- "eip_service": "= file [:eip_service_json_template, 'v'+webapp.api_version.to_s]"
+ "eip_service": "= file [:eip_service_json_template, 'v'+webapp.api_version.to_s]",
+ "soledad_service": "= file [:soledad_service_json_template, 'v'+webapp.api_version.to_s]"
},
"service_type": "public_service",
"api": {