index.js 700 B

1234567891011121314151617181920212223242526
  1. // var fs = require('fs'),
  2. // argv = require('optimist').argv
  3. var config = require('./readConfig');
  4. var Gun = require('gun')
  5. require('gun/sea')
  6. require('gun/lib/path')
  7. require('gun/lib/not')
  8. require('gun/nts')
  9. config.readConfigFile();
  10. var conf = config.parseConfigOptions();
  11. var config = { port: conf.port };
  12. //create the server
  13. if (conf.ssl) {
  14. config.server = require('https').createServer(conf.sslOptions, Gun.serve(__dirname));
  15. } else {
  16. config.server = require('http').createServer(Gun.serve(__dirname));
  17. }
  18. global.gun = Gun({ web: config.server.listen(config.port), axe: false }); //until: 5000, chunk: 10
  19. console.log('Relay peer started on port ' + config.port + ' with /gun');