diff options
author | irregulator <irregulator@riseup.net> | 2014-05-27 20:20:51 +0300 |
---|---|---|
committer | elijah <elijah@riseup.net> | 2014-07-01 16:05:41 -0700 |
commit | 86035bf6936812f5b01ac7d5e3b6d026124e156e (patch) | |
tree | da96e92259eeec42fad97951e46b80c563d1cc80 /provider_base/services | |
parent | 436d98b3781aa66c78b3ec77fa7d47652a92f590 (diff) |
Use the try method to pick vpn gateway address in obfsproxy.json
Diffstat (limited to 'provider_base/services')
-rw-r--r-- | provider_base/services/obfsproxy.json | 7 |
1 files changed, 1 insertions, 6 deletions
diff --git a/provider_base/services/obfsproxy.json b/provider_base/services/obfsproxy.json index d6771148..b14a0db9 100644 --- a/provider_base/services/obfsproxy.json +++ b/provider_base/services/obfsproxy.json @@ -4,11 +4,6 @@ "password": "= base32_secret :scramblesuit_password", "port" : "= rand_range :scramblesuit_port, 18000..32000" }, - "gateway_address": "= self['openvpn'] ? openvpn.gateway_address : nodes_like_me[:services => 'openvpn'].field('openvpn.gateway_address').shuffle.first" - // Later, if we add a SafeNil class that looks and acts like nil - // but will allow you to call methods on it (each returning another SafeNil) - // without throwing an exception, we could do: - // "gateway_address": "= self['openvpn'] ? openvpn.gateway_address : (nodes_like_me[:services => 'openvpn']['location.name' => location.name].field('openvpn.gateway_address').shuffle.first || nodes_like_me[:services => 'openvpn'].field('openvpn.gateway_address').shuffle.first)" - // Perhaps we should also create a macro. + "gateway_address": "= try{openvpn.gateway_address} || try{nodes_like_me[:services => 'openvpn']['location.name' => location.name].field('openvpn.gateway_address').shuffle.first} || try{nodes_like_me[:services => 'openvpn'].field('openvpn.gateway_address').shuffle.first}" } } |