node-go/packages/play-node-go/server/data/seeds/03_user.js
2020-02-05 16:44:35 -08:00

16 lines
No EOL
518 B
JavaScript

const {hashPassword} = require('../../services/bcrypt');
require('dotenv').config();
const password = process.env.USER_ONE_PASSWORD;
const hashedPassword = hashPassword(password);
const email = process.env.USER_ONE_EMAIL;
exports.seed = function(knex) {
// Deletes ALL existing entries
return knex('user').del()
.then(function () {
// Inserts seed entries
return knex('user').insert([
{id: 2, username: 'user-one', email: email, password: hashedPassword, admin: true},
]);
});
};