appnexus / sicksync

Don’t accept the available as the preferable. Go the extra mile with extra speed.
Apache License 2.0
68 stars 11 forks source link

Cannot find .sicksync-config.json on inital setup. #2

Closed tsantef closed 9 years ago

tsantef commented 9 years ago

It looks like the initial setup expects the json file exists before its created.

Error: Cannot find module '/.sicksync-config.json'
    at Function.Module._resolveFilename (module.js:338:15)
    at Function.Module._load (module.js:280:25)
    at Module.require (module.js:364:17)
    at require (module.js:380:17)
    at Object.<anonymous> (/sicksync/lib/rsync.js:3:14)
    at Module._compile (module.js:456:26)
    at Object.Module._extensions..js (module.js:474:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Module.require (module.js:364:17)
tsantef commented 9 years ago

I would have the util lib manage the config file allowing access to properties on a config object. Read it in like:

var config = JSON.parse(fs.readFileSync(configPath, 'utf8') || '{}')
joelgriffith commented 9 years ago

Yeah, I'm going to move it into a util as there is a an fs.exists that needs to happen prior.

joelgriffith commented 9 years ago

Should be fixed now, the bigSync module required config before it was written, which caused the error. It now only requires it the export is called.

In branch master