Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
// Source Code Plugin
const scmConfig = config.get('scm');
const ScmPlugin = require(`screwdriver-scm-${scmConfig.plugin}`);
const scm = new ScmPlugin(hoek.applyToDefaults({ ecosystem },
(scmConfig[scmConfig.plugin] || {})));
authConfig.scm = scm;
// Setup Model Factories
const Models = require('screwdriver-models');
const userFactory = Models.UserFactory.getInstance({
datastore,
scm,
password: authConfig.encryptionPassword
});
const tokenFactory = Models.TokenFactory.getInstance({
datastore
});
// Setup datastore and create test user
return datastore.setup()
.then(() => userFactory.get({ username, scmContext }))
.then((model) => {
if (!model) {
return userFactory.create({
username,
scmContext,
token: gitToken
});
}
return model.sealToken(gitToken)