Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

youzanyun-open-sdk

Package Overview
Dependencies
Maintainers
1
Versions
19
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

youzanyun-open-sdk - npm Package Compare versions

Comparing version 1.0.3 to 1.0.4

9

lib/apollo/index.js

@@ -11,4 +11,5 @@ const LruCache = require("lru-cache");

appId,
appSecret,
clusterName,
metaServerUrl,
metaServerHost,
enableCache = true,

@@ -20,4 +21,5 @@ watchNamespaces, // 需要监听的命名空间数组

this.appId = appId;
this.appSecret = appSecret;
this.clusterName = clusterName;
this.metaServerUrl = metaServerUrl;
this.metaServerHost = metaServerHost;

@@ -43,4 +45,5 @@ this.enableCache = enableCache;

appId: this.appId,
appSecret: this.appSecret,
clusterName: this.clusterName,
metaServerUrl: this.metaServerUrl,
metaServerHost: this.metaServerHost,
});

@@ -47,0 +50,0 @@ // 启动监听

@@ -8,10 +8,12 @@ const axios = require('axios');

appId,
appSecret,
clusterName, // 集群的配置
metaServerUrl, // 服务发现服务器地址
metaServerHost, // 服务发现服务器地址
clientIp // clientIp这个参数是可选的,用来实现灰度发布。 如果不想传这个参数,请注意URL中从?号开始的query parameters整个都不要出现。
}) {
this.appId = appId;
this.appSecret = appSecret;
this.clientIp = clientIp;
this.clusterName = clusterName;
this.metaServerUrl = metaServerUrl;
this.metaServerUrl = 'http://' + metaServerHost;
this.configServerUrl = ''; // 配置服务器地址

@@ -29,3 +31,4 @@ this.listenTask = {}; // 监听任务

let apolloString = `/configfiles/json/${this.appId}/${this.clusterName}/${namespaceName}`;
let apolloString = `/configs/${this.appId}/${this.clusterName}/${namespaceName}`;
if (this.clientIp) {

@@ -37,7 +40,8 @@ apolloString += `?ip=${this.clientIp}`;

headers: {
"Content-Type": "application/json;charset=UTF-8"
"auth": `${this.appId};${this.appSecret}`
},
timeout: 3000
});
return response.data;
return response.data.configurations;
}

@@ -48,4 +52,8 @@

let response = await axios.get(`${this.metaServerUrl}/services/config`, {
timeout: 3000
let response = await axios.get(`/services/config`, {
baseURL: this.metaServerUrl,
headers: {
"auth": `${this.appId};${this.appSecret}`
},
timeout: 30000
});

@@ -88,6 +96,8 @@

} catch (e) { // 调用失败,则等待10s
setInterval(_ => { // 通知异常
setImmediate(_ => { // 通知异常
callback(e, null);
});
await delay(10000);
if (e.code != 'ECONNABORTED') {
await delay(10000);
}
}

@@ -125,3 +135,6 @@ }

},
timeout: 65000
headers: {
"auth": `${this.appId};${this.appSecret}`
},
timeout: 65000,
});

@@ -128,0 +141,0 @@ let statusCode = response.status;

{
"name": "youzanyun-open-sdk",
"version": "1.0.3",
"version": "1.0.4",
"description": "",

@@ -5,0 +5,0 @@ "main": "index.js",

const Client = require('../../lib/apollo/index');
let client = new Client({
appId: 'wsc-pc-account',
appId: 'cloud_apollo_node-qa-zjf',
appSecret: '6334bf4b62f02d5bab3168153e966adc',
clusterName: 'default',
metaServerUrl: 'http://apollo-metaserver.daily.s.qima-inc.com',
metaServerHost: 'apollo-metaserver-dev.qa.s.youzanyun.net',
watchNamespaces: ['application']
})
});

@@ -15,5 +16,5 @@ async function run () {

console.log(config);
await client.getNamespaceConfig('application');
// await client.getNamespaceConfig('application');
}
run();
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc