UNPKG

thinkable-ducks

Version:

supervisor-controlled image for useful-wind

35 lines (27 loc) 1.04 kB
// Generated by CoffeeScript 2.4.1 (function() { var Bluebird, debug, fs, run, serialize; run = async function(cfg) { var errors, xml; errors = (await serialize(cfg, 'config')); if (errors > 0) { throw new Error(`config had ${errors} errors`); } // Generate the configuration for FreeSwitch // ========================================= if (cfg.server_only !== true) { debug('Building FreeSwitch configuration'); xml = (await (typeof cfg.freeswitch === "function" ? cfg.freeswitch(cfg) : void 0)); await fs.mkdir('/dev/shm/freeswitch'); return (await fs.writeFile('/dev/shm/freeswitch/freeswitch.xml', xml, 'utf-8').catch(function(error) { debug.dev(`Unable to create FreeeSwitch configuration: ${error}`); throw error; })); } }; module.exports = run; Bluebird = require('bluebird'); fs = (require('fs')).promises; serialize = require('useful-wind-serialize'); debug = (require('debug'))('thinkable-ducks:config'); }).call(this);