Skip to content

Commit 883599d

Browse files
committed
🚸 Set app infos from environments automatically (for JS SDK 4)
1 parent abbbfcc commit 883599d

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

lib/storage-extra.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,13 @@ if (process.env.LEANCLOUD_API_SERVER) {
1919
AV.setServerURLs(process.env.LEANCLOUD_API_SERVER);
2020
}
2121

22+
if (AV.version && !AV.version.match(/^[0123]\./)) {
23+
AV._config.applicationId = process.env.LEANCLOUD_APP_ID;
24+
AV._config.applicationKey = process.env.LEANCLOUD_APP_KEY;
25+
AV._config.masterKey = process.env.LEANCLOUD_APP_MASTER_KEY;
26+
AV._config.hookKey = process.env.LEANCLOUD_APP_HOOK_KEY;
27+
}
28+
2229
AV._sharedConfig.userAgent = 'AVOS Cloud Code Node ' + require('../package').version;
2330
AV.Cloud.__prod = process.env.NODE_ENV === 'production' ? 1 : 0;
2431
AV.setProduction(AV.Cloud.__prod);

0 commit comments

Comments
 (0)