Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const path = require('path')
const child = require('child_process')
const config = require('ssb-config')
const ssbKeys = require('ssb-keys')
const client = require('ssb-client')
config.keys = ssbKeys.loadOrCreateSync(path.join(config.path, 'secret'))
let retriesRemaining = 5
let server
let started = false
const tryConnect = (cb) => {
retriesRemaining--
// Check if sbot/scutlle-shell is already running
client(config.keys, config, (err, sbot) => {
// err implies no server currently running
if (err) {
// start scuttle shell if haven't already tried starting it
if (!started) {
server = child.fork(path.resolve(__dirname, './start'), {
stdio: [
'ignore',