summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorelijah <elijah@riseup.net>2012-11-15 01:18:10 -0800
committerelijah <elijah@riseup.net>2012-11-15 01:18:10 -0800
commit74047765ad815ae72a1e0eb2355e6fbc68d4db57 (patch)
tree54b245aefdfbba6c24e148e2fd1b12c5803e72b0
parentac74640c5f4a65f8f117deeaed8d1cd29a22bc3c (diff)
added eip-service.json
-rw-r--r--provider_base/files/service-definitions/eip-service.json.erb33
-rw-r--r--provider_base/services/openvpn.json5
-rw-r--r--provider_base/services/webapp.json4
3 files changed, 39 insertions, 3 deletions
diff --git a/provider_base/files/service-definitions/eip-service.json.erb b/provider_base/files/service-definitions/eip-service.json.erb
new file mode 100644
index 00000000..095f3530
--- /dev/null
+++ b/provider_base/files/service-definitions/eip-service.json.erb
@@ -0,0 +1,33 @@
+<%=
+ def underscore(words)
+ words = words.to_s.dup
+ words.downcase!
+ words.gsub! /[^a-z]/, '_'
+ words
+ end
+
+ hsh = {}
+ hsh["serial"] = 1
+ hsh["version"] = 1
+ clusters = {}
+ gateways = []
+ global.services['openvpn'].node_list.each_node do |node|
+ next if node.vagrant?
+ gateway = {}
+ gateway["capabilities"] = node.openvpn.pick(
+ :ports, :protocols, :user_ips, :adblock, :filter_dns)
+ gateway["capabilities"]["transport"] = ["openvpn"]
+ gateway["ip_address"] = node.ip_address
+ gateway["host"] = node.domain.full
+ gateway["cluster"] = underscore(node.openvpn.location)
+ gateways << gateway
+ clusters[gateway["cluster"]] ||= {
+ "name" => gateway["cluster"],
+ "label" => {"en" => node.openvpn.location}
+ }
+ end
+ hsh["gateways"] = gateways
+ hsh["clusters"] = clusters.values
+
+ generate_json hsh
+%> \ No newline at end of file
diff --git a/provider_base/services/openvpn.json b/provider_base/services/openvpn.json
index 4b7d25ec..46dcd50e 100644
--- a/provider_base/services/openvpn.json
+++ b/provider_base/services/openvpn.json
@@ -4,9 +4,12 @@
"use": true
},
"openvpn": {
+ "location": "Location Unknown",
"ports": ["80", "443", "53", "1194"],
+ "protocols": ["tcp", "udp"],
"filter_dns": false,
- "nat": true,
+ "adblock": false,
+ "user_ips": false,
"ca_crt": "= file :ca_cert",
"ca_key": "= file :ca_key",
"dh": "= file :dh_params"
diff --git a/provider_base/services/webapp.json b/provider_base/services/webapp.json
index 6e5c029c..7e12d26e 100644
--- a/provider_base/services/webapp.json
+++ b/provider_base/services/webapp.json
@@ -5,8 +5,8 @@
"couchdb_user": "= global.services[:couchdb].couch.users[:webapp]"
},
"definition_files": {
- "provider": "= file('service-definitions/provider.json.erb')",
- "eip_service": "file('service-definitions/eip-service.json.erb')"
+ "provider": "= file 'service-definitions/provider.json.erb'",
+ "eip_service": "= file 'service-definitions/eip-service.json.erb'"
},
"service_type": "public_service",
"api_domain": "= 'api.' + domain.full_suffix",