Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
CoCo_Code_Op2
Node Apollo
提交
e712bfdb
N
Node Apollo
项目概览
CoCo_Code_Op2
/
Node Apollo
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
N
Node Apollo
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
e712bfdb
编写于
11月 01, 2017
作者:
Q
Quinton.Xu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix typo
上级
b0379639
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
10 addition
and
6 deletion
+10
-6
README.md
README.md
+5
-4
lib/helper.js
lib/helper.js
+5
-2
未找到文件。
README.md
浏览文件 @
e712bfdb
...
@@ -36,7 +36,7 @@ Node.js >= 6.0.0 required.
...
@@ -36,7 +36,7 @@ Node.js >= 6.0.0 required.
configServerUrl: 'http://example.com',
configServerUrl: 'http://example.com',
appId: '<appId>',
appId: '<appId>',
clusterName: 'default',
clusterName: 'default',
namespaceName: [ 'namespaceName1', 'namespaceName2' ],
namespaceName: [ 'namespaceName1', 'namespaceName2' ],
// n1的配置会被n2配置覆盖
// clientIp: '',
// clientIp: '',
};
};
const result = await apollo.remoteConfigServiceFromCache(config);
const result = await apollo.remoteConfigServiceFromCache(config);
...
@@ -48,8 +48,9 @@ Node.js >= 6.0.0 required.
...
@@ -48,8 +48,9 @@ Node.js >= 6.0.0 required.
configServerUrl: 'http://example.com',
configServerUrl: 'http://example.com',
appId: '<appId>',
appId: '<appId>',
clusterName: 'default',
clusterName: 'default',
namespaceName: [ 'namespaceName1', 'namespaceName2' ],
namespaceName: [ 'namespaceName1', 'namespaceName2' ], // n1的配置会被n2配置覆盖
// clientIp: '',
// clientIp: '', // optional
// releaseKey: '', // optional
};
};
const result = await apollo.remoteConfigServiceSikpCache(config);
const result = await apollo.remoteConfigServiceSikpCache(config);
```
```
...
@@ -60,7 +61,7 @@ Node.js >= 6.0.0 required.
...
@@ -60,7 +61,7 @@ Node.js >= 6.0.0 required.
configServerUrl: 'http://example.com',
configServerUrl: 'http://example.com',
appId: '<appId>',
appId: '<appId>',
clusterName: 'default',
clusterName: 'default',
namespaceName: '',
namespaceName: '',
//no surport multi namespace name, optional
apolloEnv: 'dev',
apolloEnv: 'dev',
token: '<apollo access token>'
token: '<apollo access token>'
// clientIp: '',
// clientIp: '',
...
...
lib/helper.js
浏览文件 @
e712bfdb
...
@@ -91,9 +91,10 @@ module.exports = {
...
@@ -91,9 +91,10 @@ module.exports = {
assert
(
appId
,
'
appId is required
'
);
assert
(
appId
,
'
appId is required
'
);
assert
(
clusterName
,
'
clusterName is required
'
);
assert
(
clusterName
,
'
clusterName is required
'
);
if
(
Array
.
isArray
(
namespaceName
))
{
if
(
Array
.
isArray
(
namespaceName
))
{
if
(
namespaceName
.
length
===
0
)
return
[
`
${
configServerUrl
}
/configfiles/json/
${
appId
}
/
${
clusterName
}
/application?ip=
${
clientIp
}
`
];
return
namespaceName
.
map
(
n
=>
`
${
configServerUrl
}
/configfiles/json/
${
appId
}
/
${
clusterName
}
/
${
namespaceName
}
?ip=
${
clientIp
}
`
);
return
namespaceName
.
map
(
n
=>
`
${
configServerUrl
}
/configfiles/json/
${
appId
}
/
${
clusterName
}
/
${
namespaceName
}
?ip=
${
clientIp
}
`
);
}
else
{
}
else
{
return
Arrary
.
from
(
`
${
configServerUrl
}
/configfiles/json/
${
appId
}
/
${
clusterName
}
/
${
namespaceName
}
?ip=
${
clientIp
}
`
)
;
return
[
`
${
configServerUrl
}
/configfiles/json/
${
appId
}
/
${
clusterName
}
/
${
namespaceName
}
?ip=
${
clientIp
}
`
]
;
}
}
},
},
...
@@ -105,9 +106,11 @@ module.exports = {
...
@@ -105,9 +106,11 @@ module.exports = {
assert
(
appId
,
'
appId is required
'
);
assert
(
appId
,
'
appId is required
'
);
assert
(
clusterName
,
'
clusterName is required
'
);
assert
(
clusterName
,
'
clusterName is required
'
);
if
(
Array
.
isArray
(
namespaceName
))
{
if
(
Array
.
isArray
(
namespaceName
))
{
console
.
log
(
[
`
${
configServerUrl
}
/configs/
${
appId
}
/
${
clusterName
}
/application?releaseKey=
${
releaseKey
}
&ip=
${
clientIp
}
`
])
if
(
namespaceName
.
length
===
0
)
return
[
`
${
configServerUrl
}
/configs/
${
appId
}
/
${
clusterName
}
/application?releaseKey=
${
releaseKey
}
&ip=
${
clientIp
}
`
];
return
namespaceName
.
map
(
n
=>
`
${
configServerUrl
}
/configs/
${
appId
}
/
${
clusterName
}
/
${
n
}
?releaseKey=
${
releaseKey
}
&ip=
${
clientIp
}
`
);
return
namespaceName
.
map
(
n
=>
`
${
configServerUrl
}
/configs/
${
appId
}
/
${
clusterName
}
/
${
n
}
?releaseKey=
${
releaseKey
}
&ip=
${
clientIp
}
`
);
}
else
{
}
else
{
return
Arrary
.
from
(
`
${
configServerUrl
}
/configs/
${
appId
}
/
${
clusterName
}
/
${
namespaceName
}
?releaseKey=
${
releaseKey
}
&ip=
${
clientIp
}
`
)
;
return
[
`
${
configServerUrl
}
/configs/
${
appId
}
/
${
clusterName
}
/
${
namespaceName
}
?releaseKey=
${
releaseKey
}
&ip=
${
clientIp
}
`
]
;
}
}
}
}
};
};
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录