Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
N
node-apollo
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
DevOps
node-apollo
Commits
b0379639
Commit
b0379639
authored
Nov 01, 2017
by
Quinton.Xu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix data merge
parent
ca6a187b
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
4 deletions
+5
-4
helper.js
lib/helper.js
+3
-2
index.js
test/index.js
+2
-2
No files found.
lib/helper.js
View file @
b0379639
...
...
@@ -36,7 +36,8 @@ module.exports = {
mergeConfigurations
(
payload
)
{
assert
(
Array
.
isArray
(
payload
),
'
Apollo config should be an array
'
);
try
{
const
confs
=
payload
.
map
(
pl
=>
pl
.
data
.
configurations
);
// 从缓存和非缓存获取的response报文不一致
const
confs
=
payload
.
map
(
pl
=>
pl
.
data
.
configurations
||
pl
.
data
);
return
Object
.
assign
({},
...
confs
);
}
catch
(
err
)
{
assert
(
err
,
'
Apollo configs not be merged
'
);
...
...
@@ -52,7 +53,7 @@ module.exports = {
}
return
ret
;
},
// clientIp这个参数是可选的,用来实现灰度发布。 如果不想传这个参数,请注意URL中从?号开始的query parameters整个都不要出现。
getConfigFromApolloUri
(
config
)
{
// 读取环境变量
...
...
test/index.js
View file @
b0379639
...
...
@@ -25,7 +25,7 @@ describe('#index', function () {
configServerUrl
:
'
http://example.com
'
,
appId
:
'
<appId>
'
,
clusterName
:
'
default
'
,
namespaceName
:
[
'
namespaceName1
'
,
'
namespaceName
1
'
],
namespaceName
:
[
'
namespaceName1
'
,
'
namespaceName
2
'
],
// clientIp: '',
};
const
result
=
await
apollo
.
remoteConfigServiceFromCache
(
eggConfig
);
...
...
@@ -38,7 +38,7 @@ describe('#index', function () {
configServerUrl
:
'
http://example.com
'
,
appId
:
'
<appId>
'
,
clusterName
:
'
default
'
,
namespaceName
:
[
'
namespaceName1
'
,
'
namespaceName
1
'
],
namespaceName
:
[
'
namespaceName1
'
,
'
namespaceName
2
'
],
// clientIp: '',
};
const
result
=
await
apollo
.
remoteConfigServiceSikpCache
(
eggConfig
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment