Skip to content
This repository has been archived by the owner on Dec 20, 2017. It is now read-only.

Commit

Permalink
Merge pull request #96 from jysperm/fetch-appkey
Browse files Browse the repository at this point in the history
重构 AV 对象初始化、查询并记录 appKey、运行时向程序发送 appKey
  • Loading branch information
sdjcw committed Oct 22, 2015
2 parents c06d108 + 2a68c93 commit 9592906
Show file tree
Hide file tree
Showing 6 changed files with 227 additions and 166 deletions.
7 changes: 3 additions & 4 deletions bin/avoscloud
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,6 @@ if(CMD) {
break;

case "upload":
run.initAVOSCloudSDK();
run.logProjectHome();
if (!program.args[1]) {
console.log("请使用:avoscloud upload <文件或目录>");
Expand Down Expand Up @@ -223,14 +222,14 @@ if(CMD) {
console.log('[INFO] 因为文件变更而项目重启:', files);
});
if (runtimeInfo.runtime != 'cloudcode') {
run.initMasterKey(function(masterKey) {
run.initAVOSCloudSDK(function(AV) {
var app = run.getAppSync();
var testServerPort = parseInt(run.getPort()) + 1;
testServer.set('leanenginePort', run.getPort());
testServer.set('port', testServerPort);
testServer.set('appId', app.appId);
testServer.set('appKey', masterKey);
testServer.set('masterKey', masterKey);
testServer.set('appKey', AV.applicationKey);
testServer.set('masterKey', AV.masterKey);
console.log(color.green('提示:您可以使用 http://localhost:' + testServerPort + ' 测试 Cloud 函数'));
testServer.listen(testServerPort);
});
Expand Down
4 changes: 2 additions & 2 deletions bin/cloudcodeRun.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict';
var fs = require('fs');
var path = require('path');
var AV = require('avoscloud-sdk').AV;
var run = require('./run');
var commander = require('./commander');
var lib = path.join(path.dirname(fs.realpathSync(__filename)), '../lib');
Expand All @@ -15,7 +15,7 @@ if (!CLOUD_PATH.match(/.*\/$/)) {
}

run.logProjectHome();
run.initAVOSCloudSDK(function(masterKey) {
run.initAVOSCloudSDK(function(AV) {
require(lib + '/mock').run(CLOUD_PATH, AV, run.getPort());
console.log("请使用浏览器打开 http://localhost:" + run.getPort() + "/avos");
});
Loading

0 comments on commit 9592906

Please sign in to comment.