调整脚本
This commit is contained in:
parent
bc7e427b9a
commit
553fdadc84
@ -5,6 +5,9 @@ source /etc/profile
|
||||
npm install --prefer-offline --loglevel info --unsafe-perm=true --allow-root >> boundle.log
|
||||
echo 'copy node_modules to /data/publish/node_packages' >> boundle.log
|
||||
|
||||
npm run clear
|
||||
npm run init:roles
|
||||
|
||||
gulp
|
||||
|
||||
rm -rf ./src
|
||||
|
10
clear-data.js
Normal file
10
clear-data.js
Normal file
@ -0,0 +1,10 @@
|
||||
const pmf = require('pow-mongodb-fixtures');
|
||||
const config = require('./config/config');
|
||||
|
||||
const fixtures = pmf.connect(config.db_admin);
|
||||
|
||||
fixtures.clear(['ldap_users', 'users'], function(err) {
|
||||
if (err) console.log(err);
|
||||
console.log('用户数据已清空');
|
||||
process.exit(0);
|
||||
});
|
@ -7,11 +7,17 @@ exports.roles = [
|
||||
{
|
||||
_id: ObjectId('5cdcdd0c25609b18348ef7b5'),
|
||||
permissions: [
|
||||
'games-writeable',
|
||||
'settings-writeable',
|
||||
'users-writeable',
|
||||
'permission-writeable',
|
||||
'logs-writeable',
|
||||
'dics-writeable',
|
||||
'data-writeable'
|
||||
'data-writeable',
|
||||
'5cab2cf84182d72b6c8f888e-readable',
|
||||
'5cad510b38c4102978897f19-readable',
|
||||
'5cde727eee102c3cf0df19f5-readable',
|
||||
'5cde7d64d132d73f94fcbe66-readable'
|
||||
],
|
||||
name: '系统管理员',
|
||||
rolename: 'admin',
|
||||
|
12
init-roles.js
Normal file
12
init-roles.js
Normal file
@ -0,0 +1,12 @@
|
||||
const pmf = require('pow-mongodb-fixtures')
|
||||
const config = require('./config/config')
|
||||
const path = require('path')
|
||||
|
||||
const fixtures = pmf.connect(config.db_admin);
|
||||
const fixturesDir = path.join(config.root, '/fixtures');
|
||||
|
||||
fixtures.clearAndLoad(fixturesDir, function(err) {
|
||||
if (err) console.log(err);
|
||||
console.log('roles 数据加载完毕!');
|
||||
process.exit(0);
|
||||
});
|
@ -7,7 +7,8 @@
|
||||
"test": "echo \"Error: no test specified\" && exit 1",
|
||||
"dev": "cross-env nodemon src/app.js --exec babel-node ",
|
||||
"pro": "cross-env NODE_ENV=production nodemon src/app.js --exec babel-node ",
|
||||
"init": "cross-env nodemon src/init-data.js --exec babel-node"
|
||||
"init:roles": "node init-roles.js",
|
||||
"clear": "node clear-data.js"
|
||||
},
|
||||
"keywords": [],
|
||||
"author": "",
|
||||
|
@ -47,6 +47,7 @@ const extension = function(file) {
|
||||
* type: 类型
|
||||
* */
|
||||
router.post('/upload', uploadMsg.single('image-file'), function(req, res, next) {
|
||||
console.log('图片上传')
|
||||
const file = req.file;
|
||||
const fileName = file.path;
|
||||
const subPath = req.body.sub_path ? req.body.sub_path : '/';
|
||||
|
@ -39,7 +39,6 @@ router.post('/login', function(req, res, next) {
|
||||
let isAdmin = false;
|
||||
|
||||
// 判断用户是否是管理员
|
||||
|
||||
client.search(
|
||||
'cn=gmplatform-admin,ou=group,dc=kingsome,dc=cn',
|
||||
{
|
||||
|
@ -1,12 +0,0 @@
|
||||
import pmf from 'pow-mongodb-fixtures';
|
||||
import config from '../config/config';
|
||||
import path from 'path';
|
||||
|
||||
const fixture = pmf.connect(config.db_admin);
|
||||
const fixturesDir = path.join(config.root, '/fixtures');
|
||||
|
||||
fixture.clearAndLoad(fixturesDir, function(err) {
|
||||
if (err) console.log(err);
|
||||
console.log('初始数据加载完毕!');
|
||||
process.exit(0);
|
||||
});
|
Loading…
x
Reference in New Issue
Block a user