gemfedwiki (509B)
1 #!/usr/bin/env node 2 3 const fs = require('fs') 4 5 const gemfedwiki = require('./') 6 7 const cert = read_pem('cert.pem') 8 const key = read_pem('key.pem') 9 const passphrase = process.env.PASSPHRASE 10 11 const server = gemfedwiki({cert, key, passphrase}) 12 const port = process.env.PORT || 1965 13 14 server.listen(port) 15 console.log(`gemfedwiki server listening on 0.0.0.0:${port}`) 16 17 function read_pem(filename) 18 { 19 if (!fs.existsSync(filename)) 20 throw new Error(`Couldn't load ${filename}`) 21 22 return fs.readFileSync(filename) 23 }