@@ -8,7 +8,9 @@ const initialize = (appId, appKey, masterKey, hookKey) => {
88 AV . applicationId = appId ;
99 AV . applicationKey = appKey ;
1010 AV . masterKey = masterKey ;
11- AV . hookKey = hookKey || ( AV . _config . isNode && process . env . LEANCLOUD_APP_HOOK_KEY ) ;
11+ if ( ! process . env . CLIENT_PLATFORM ) {
12+ AV . hookKey = hookKey || process . env . LEANCLOUD_APP_HOOK_KEY ;
13+ }
1214 AV . _useMasterKey = false ;
1315} ;
1416
@@ -31,7 +33,7 @@ AV.init = (...args) => {
3133 case 1 :
3234 const options = args [ 0 ] ;
3335 if ( typeof options === 'object' ) {
34- if ( ! AV . _config . isNode && options . masterKey ) {
36+ if ( process . env . CLIENT_PLATFORM && options . masterKey ) {
3537 masterKeyWarn ( ) ;
3638 }
3739 initialize ( options . appId , options . appKey , options . masterKey , options . hookKey ) ;
@@ -47,7 +49,7 @@ AV.init = (...args) => {
4749 console . warn ( 'Please use AV.init() to replace AV.initialize(), ' +
4850 'AV.init() need an Object param, like { appId: \'YOUR_APP_ID\', appKey: \'YOUR_APP_KEY\' } . ' +
4951 'Docs: https://leancloud.cn/docs/sdk_setup-js.html' ) ;
50- if ( ! AV . _config . isNode && args . length === 3 ) {
52+ if ( process . env . CLIENT_PLATFORM && args . length === 3 ) {
5153 masterKeyWarn ( ) ;
5254 }
5355 initialize ( ...args ) ;
@@ -57,7 +59,7 @@ AV.init = (...args) => {
5759} ;
5860
5961// If we're running in node.js, allow using the master key.
60- if ( AV . _config . isNode ) {
62+ if ( ! process . env . CLIENT_PLATFORM ) {
6163 AV . Cloud = AV . Cloud || { } ;
6264 /**
6365 * Switches the LeanCloud SDK to using the Master key. The Master key grants
0 commit comments