Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
exports.createDefaultEnvironment = async function(initialModels = []) {
let repoPath = await temp.mkdir('cardstack-server-test');
// TODO: The git writer should make its own local repo when it
// starts up the first time.
let { head, repo } = await makeRepo(repoPath);
let factory = new JSONAPIFactory();
let user = factory.addResource('users', 'the-default-test-user').withAttributes({
fullName: 'Default Test Environment',
email: 'test@example.com'
});
factory.addResource('plugin-configs')
.withAttributes({
module: '@cardstack/hub',
}).withRelated(
'default-data-source',
factory.addResource('data-sources')
.withAttributes({
'source-type': '@cardstack/git',
const Change = require('@cardstack/git/change');
const Gitchain = require('cardstack-gitchain');
const oldMakeCommit = Change.prototype._makeCommit;
const log = require('@cardstack/logger')('cardstack/git-hyperledger');
Change.prototype._makeCommit = async function(commitOpts) {
let commit = await oldMakeCommit.call(this, commitOpts);
let gitchain = new Gitchain(this.repo.path(), null, {logger: log.info.bind(log)});
try {
await gitchain.push(commit.sha());
} catch (e) {
log.error("Error pushing to hyperledger blockchain");
}
return commit;
};
const Change = require('@cardstack/git/change');
const Gitchain = require('cardstack-gitchain');
const oldMakeCommit = Change.prototype._makeCommit;
const log = require('@cardstack/logger')('cardstack/git-hyperledger');
Change.prototype._makeCommit = async function(commitOpts) {
let commit = await oldMakeCommit.call(this, commitOpts);
let gitchain = new Gitchain(this.repo.path(), null, {logger: log.info.bind(log)});
try {
await gitchain.push(commit.sha());
} catch (e) {
log.error("Error pushing to hyperledger blockchain");
}
return commit;
};