Comparing version
@@ -1,2 +0,2 @@ | ||
var port = process.env.OPENSHIFT_NODEJS_PORT || process.env.VCAP_APP_PORT || process.env.PORT || process.argv[2] || 8080; | ||
var port = process.env.OPENSHIFT_NODEJS_PORT || process.env.VCAP_APP_PORT || process.env.PORT || process.argv[2] || 8765; | ||
var host = process.env.OPENSHIFT_NODEJS_HOST || process.env.VCAP_APP_HOST || process.env.HOST || 'localhost'; | ||
@@ -3,0 +3,0 @@ |
console.log("If module not found, install express globally `npm i express -g`!"); | ||
var port = process.env.OPENSHIFT_NODEJS_PORT || process.env.VCAP_APP_PORT || process.env.PORT || process.argv[2] || 8080; | ||
var port = process.env.OPENSHIFT_NODEJS_PORT || process.env.VCAP_APP_PORT || process.env.PORT || process.argv[2] || 8765; | ||
var express = require('express'); | ||
@@ -4,0 +4,0 @@ var Gun = require('..'); |
@@ -8,3 +8,3 @@ console.log("If module not found, install hapi globally `npm i hapi inert -g`!") | ||
const server = new Hapi.Server({ | ||
port: 8080, | ||
port: 8765, | ||
host: 'localhost', | ||
@@ -11,0 +11,0 @@ routes: { |
@@ -1,2 +0,2 @@ | ||
var port = process.env.OPENSHIFT_NODEJS_PORT || process.env.VCAP_APP_PORT || process.env.PORT || process.argv[2] || 8080; | ||
var port = process.env.OPENSHIFT_NODEJS_PORT || process.env.VCAP_APP_PORT || process.env.PORT || process.argv[2] || 8765; | ||
@@ -3,0 +3,0 @@ var Gun = require('../'); |
@@ -1,22 +0,20 @@ | ||
var port = process.env.OPENSHIFT_NODEJS_PORT || process.env.VCAP_APP_PORT || process.env.PORT || process.argv[2] || 8080 || 8765; | ||
var fs = require('fs'); | ||
var config = { | ||
port: process.env.OPENSHIFT_NODEJS_PORT || process.env.VCAP_APP_PORT || process.env.PORT || process.argv[2] || 8765 | ||
}; | ||
var Gun = require('../'); // require('gun') | ||
var Gun = require('../'); | ||
if(process.env.HTTPS_KEY){ | ||
config.key = fs.readFileSync(process.env.HTTPS_KEY); | ||
config.cert = fs.readFileSync(process.env.HTTPS_CERT); | ||
config.server = require('https').createServer(config, Gun.serve(__dirname)); | ||
} else { | ||
config.server = require('http').createServer(Gun.serve(__dirname)); | ||
} | ||
var server = require('http').createServer(function(req, res){ | ||
if(Gun.serve(req, res)){ return } // filters gun requests! | ||
require('fs').createReadStream(require('path').join(__dirname, req.url)).on('error',function(){ // static files! | ||
res.writeHead(200, {'Content-Type': 'text/html'}); | ||
res.end(require('fs') | ||
.readFileSync(require('path') | ||
.join(__dirname, 'index.html') // or default to index | ||
)); | ||
}).pipe(res); // stream | ||
}); | ||
var gun = Gun({ | ||
web: server | ||
web: config.server | ||
}); | ||
server.listen(port); | ||
console.log('Server started on port ' + port + ' with /gun'); | ||
config.server.listen(config.port); | ||
console.log('Server started on port ' + config.port + ' with /gun'); |
console.log("If modules not found, run `npm install` in /example folder!"); | ||
var port = process.env.OPENSHIFT_NODEJS_PORT || process.env.VCAP_APP_PORT || process.env.PORT || process.argv[2] || 8081; | ||
var port = process.env.OPENSHIFT_NODEJS_PORT || process.env.VCAP_APP_PORT || process.env.PORT || process.argv[2] || 8765; | ||
var host = process.env.OPENSHIFT_NODEJS_HOST || process.env.VCAP_APP_HOST || process.env.HOST || 'localhost'; | ||
@@ -18,5 +18,5 @@ | ||
app.use(Gun.serve); | ||
app.use(proxy(host + ':8080')); | ||
app.use(proxy(host + ':8765')); | ||
server.listen(port); | ||
console.log('Server started on port ' + port + ' with /gun'); |
@@ -1,2 +0,16 @@ | ||
module.exports = function serve(req, res, next){ | ||
var fs = require('fs'); | ||
var path = require('path'); | ||
function CDN(dir){ | ||
return function(req, res){ | ||
if(serve(req, res)){ return } // filters GUN requests! | ||
fs.createReadStream(path.join(dir, req.url)).on('error',function(){ // static files! | ||
res.writeHead(200, {'Content-Type': 'text/html'}); | ||
res.end(fs.readFileSync(path.join(dir, 'index.html'))); // or default to index | ||
}).pipe(res); // stream | ||
} | ||
} | ||
function serve(req, res, next){ | ||
if(typeof req === 'string'){ return CDN(req) } | ||
if(!req || !res){ return false } | ||
@@ -20,2 +34,4 @@ next = next || serve; | ||
return next(); | ||
} | ||
} | ||
module.exports = serve; |
@@ -35,3 +35,3 @@ (function(){ | ||
} | ||
var gun = window.gun = Gun(); //Gun('http://localhost:8080/gun'); | ||
var gun = window.gun = Gun(); | ||
window.SPAM = function(read){ // TODO: BUG? gun-sid in transport layer not correct? | ||
@@ -38,0 +38,0 @@ //localStorage.clear(); |
{ | ||
"name": "gun", | ||
"version": "0.9.9997", | ||
"version": "0.9.9998", | ||
"description": "A realtime, decentralized, offline-first, graph data synchronization engine.", | ||
@@ -8,3 +8,3 @@ "main": "index.js", | ||
"scripts": { | ||
"start": "node examples/http.js 8080", | ||
"start": "node examples/http.js 8765", | ||
"prepublishOnly": "npm run unbuild", | ||
@@ -11,0 +11,0 @@ "test": "mocha", |
@@ -191,3 +191,3 @@ <p> | ||
```bash | ||
docker run -p 8080:8080 gundb/gun | ||
docker run -p 8765:8765 gundb/gun | ||
``` | ||
@@ -201,3 +201,3 @@ | ||
docker build -t myrepo/gundb:v1 . | ||
docker run -p 8080:8080 myrepo/gundb:v1 | ||
docker run -p 8765:8765 myrepo/gundb:v1 | ||
``` | ||
@@ -209,6 +209,6 @@ | ||
npm run docker | ||
docker run -p 8080:8080 username/gun:git | ||
docker run -p 8765:8765 username/gun:git | ||
``` | ||
Then visit [http://localhost:8080](http://localhost:8080) in your browser. | ||
Then visit [http://localhost:8765](http://localhost:8765) in your browser. | ||
@@ -215,0 +215,0 @@ ## License |
module.exports = function(port, file, cb, inject){ | ||
port = port || process.env.OPENSHIFT_NODEJS_PORT || process.env.VCAP_APP_PORT || process.env.PORT || process.argv[2] || 8080; | ||
port = port || process.env.OPENSHIFT_NODEJS_PORT || process.env.VCAP_APP_PORT || process.env.PORT || process.argv[2] || 8765; | ||
@@ -4,0 +4,0 @@ var fs = require('fs'); |
var config = { | ||
IP: require('ip').address(), | ||
port: 8080, | ||
port: 8765, | ||
servers: 2, | ||
@@ -5,0 +5,0 @@ browsers: 2, |
var config = { | ||
IP: require('ip').address(), | ||
port: 8080, | ||
port: 8765, | ||
servers: 2, | ||
@@ -5,0 +5,0 @@ dir: __dirname |
@@ -25,3 +25,3 @@ require('./holy/grail'); | ||
gun.wsp(server); | ||
server.listen(8080); | ||
server.listen(8765); | ||
@@ -33,6 +33,6 @@ var clients = panic.clients; | ||
.forBrowser('firefox').build() | ||
.get('http://localhost:8080/panic.html'); | ||
.get('http://localhost:8765/panic.html'); | ||
var ff2 = new wd.Builder() | ||
.forBrowser('firefox').build() | ||
.get('http://localhost:8080/panic.html'); | ||
.get('http://localhost:8765/panic.html'); | ||
@@ -39,0 +39,0 @@ function min(n, done, list){ |
@@ -50,3 +50,3 @@ /* | ||
// start the server on :8080 | ||
// start the server on :8765 | ||
spawn('node', [serverPath]); | ||
@@ -53,0 +53,0 @@ |
{ | ||
"panic": 3000, | ||
"gun": 8080 | ||
"gun": 8765 | ||
} |
var config = { | ||
IP: require('ip').address(), | ||
port: 8080, | ||
port: 8765, | ||
servers: 2, | ||
@@ -5,0 +5,0 @@ browsers: 2, |
var config = { | ||
IP: require('ip').address(), | ||
port: 8080, | ||
port: 8765, | ||
servers: 1, | ||
@@ -5,0 +5,0 @@ browsers: 4, |
var config = { | ||
IP: require('ip').address(), | ||
port: 8080, | ||
port: 8765, | ||
servers: 2, | ||
@@ -5,0 +5,0 @@ browsers: 3, |
var config = { | ||
IP: require('ip').address(), | ||
port: 8080, | ||
port: 8765, | ||
servers: 2, | ||
@@ -5,0 +5,0 @@ browsers: 0, |
var config = { | ||
IP: require('ip').address(), | ||
port: 8080, | ||
port: 8765, | ||
servers: 2, | ||
@@ -5,0 +5,0 @@ browsers: 0, |
var config = { | ||
IP: require('ip').address(), | ||
port: 8080, | ||
port: 8765, | ||
servers: 1, | ||
@@ -5,0 +5,0 @@ browsers: 2, |
var config = { | ||
IP: require('ip').address(), | ||
port: 8080, | ||
port: 8765, | ||
servers: 1, | ||
@@ -5,0 +5,0 @@ browsers: 2, |
var config = { | ||
IP: require('ip').address(), | ||
port: 8080, | ||
port: 8765, | ||
servers: 1, | ||
@@ -5,0 +5,0 @@ browsers: 2, |
var config = { | ||
IP: require('ip').address(), | ||
port: 8080, | ||
port: 8765, | ||
servers: 2, | ||
@@ -5,0 +5,0 @@ browsers: 2, |
var config = { | ||
IP: require('ip').address(), | ||
port: 8080, | ||
port: 8765, | ||
servers: 1, | ||
@@ -5,0 +5,0 @@ browsers: 2, |
@@ -27,3 +27,3 @@ ;(function(){ | ||
var gun = Gun({localStorage: false, peers: 'http://localhost:8080/gun'}); | ||
var gun = Gun({localStorage: false, peers: 'http://localhost:8765/gun'}); | ||
var g = gun.get('test'); | ||
@@ -30,0 +30,0 @@ var room = Gun.text.random(100); |
@@ -13,4 +13,4 @@ //client.js writes data up to a listening hub.js, which relays to a server.js that reads the data. | ||
gun.wsp(server); | ||
server.listen(8080); | ||
server.listen(8765); | ||
console.log('Server started on port ' + 8080 + ' with /gun'); | ||
console.log('Server started on port ' + 8765 + ' with /gun'); |
@@ -5,3 +5,3 @@ var Gun = require('../../index'); | ||
var gun = Gun( { file: 'read.json', peers: ['http://' + location.host + ':8080/gun'] }); | ||
var gun = Gun( { file: 'read.json', peers: ['http://' + location.host + ':8765/gun'] }); | ||
@@ -8,0 +8,0 @@ gun.get( 'data' ).path('stuff').map(function(val,field){ console.log( field, "=", val ); } ); |
@@ -5,4 +5,4 @@ var Gun = require('../../index'); | ||
var gun = Gun( { file: 'write.json', peers: ['http://' + location.host + ':8080/gun'] }); | ||
var gun = Gun( { file: 'write.json', peers: ['http://' + location.host + ':8765/gun'] }); | ||
gun.get( 'data' ).path('stuff').put({a: {data: 1}, b: {data: 2}}); |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 2 instances in 1 package
1759854
3.15%251
0.8%42312
0.03%126
2.44%33
3.13%