Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function createService(program, callback){
console.log('Creating auth file...')
var service = {}
var targetPath = program.targetPath || process.cwd()
service.appId = uuid.v4()
service.appName = program.appName || 'unnamed'
service.appSecret = createSecret()
var data = JSON.stringify(service, null, 2)
fs.writeFile(targetPath+'/'+service.appId+'.json', data, 'UTF-8', function (err) {
if (err) console.error(err)
console.log('Create auth file in path '+targetPath)
})
}
function createService(program, callback){
console.log('Creating auth file...')
var service = {}
var targetPath = program.targetPath || process.cwd()
service.appId = uuid.v4()
service.appName = program.appName || 'unnamed'
service.appSecret = createSecret()
var data = JSON.stringify(service, null, 2)
fs.writeFile(targetPath+'/'+service.appId+'.json', data, 'UTF-8', function (err) {
if (err) console.error(err)
console.log('Create auth file in path '+targetPath)
})
}
}, function(err, ok) {
if (!ok || ok.toLowerCase().charAt(0) !== "y") {
return reject("Aborted.");
} else {
fs.writeFile(packagePath, data, "utf-8").then(resolve, reject);
}
});
});
module.exports = co.wrap(function*(name, mutate){
const path = 'config/spirits/'+name+'/config.json';
const json = yield fs.readFile(path);
const config = JSON.parse(json);
const mutatedConfig = yield (mutate(config) || config);
const contents = JSON.stringify(mutatedConfig, null, ' ');
return fs.writeFile(path, contents);
});
const writeCommitAndRef = co.wrap(function *(dir, name, commitAndRef) {
const filePath = path.join(dir, name);
let content = commitAndRef.sha + "\n";
if (null !== commitAndRef.ref) {
content += commitAndRef.ref + "\n";
}
yield fs.writeFile(filePath, content);
});