Make sure the responses are at least non-empty, otherwise we're going to get into a broken vpn situation.

This commit is contained in:
Pagan Gazzard 2014-10-17 15:54:21 +01:00 committed by Pablo Carranza Vélez
parent 4c257c8e7d
commit 73c62cb5be

View File

@ -83,6 +83,10 @@ module.exports = ->
throw body
console.log('Configuring VPN..', JSON.stringify(body))
for prop in ['ca', 'cert', 'vpnhost', 'vpnport'] when _.isEmpty(body[prop])
throw new Error("'#{prop}' is empty, cannot bootstrap")
vpnConf = fs.readFileAsync(__dirname + '/openvpn.conf.tmpl', 'utf8')
.then (tmpl) ->
fs.writeFileAsync('/data/client.conf', _.template(tmpl)(body))