Skip to content

Commit ff03829

Browse files
committed
fix of for local anchors file
1 parent 7a93b01 commit ff03829

File tree

1 file changed

+12
-9
lines changed

1 file changed

+12
-9
lines changed

bin/common.ts

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -56,16 +56,19 @@ export async function nodeOpts(opts: MainOptions): Promise<FabricOptions> {
5656

5757
export async function anchorFromOpts(opts: MainOptions): Promise<AnchorStore> {
5858
const localAnchors = opts.localAnchors || process.env.FABRIC_LOCAL_ANCHORS;
59-
const remoteAnchors =
60-
opts.remoteAnchors ||
61-
(process.env.FABRIC_REMOTE_ANCHORS
62-
? process.env.FABRIC_REMOTE_ANCHORS.split(',')
63-
: ['http://127.0.0.1:7225/root-anchors.json']);
59+
const remoteAnchors = opts.remoteAnchors || (process.env.FABRIC_REMOTE_ANCHORS ? process.env.FABRIC_REMOTE_ANCHORS.split(',') : undefined);
6460

65-
return AnchorStore.create({
66-
localPath: localAnchors,
67-
remoteUrls: remoteAnchors,
68-
});
61+
const updateOptions: any = {};
62+
63+
if (localAnchors) {
64+
updateOptions.localPath = localAnchors;
65+
} else if (remoteAnchors) {
66+
updateOptions.remoteUrls = remoteAnchors;
67+
} else {
68+
updateOptions.remoteUrls = ['http://127.0.0.1:7225/root-anchors.json'];
69+
}
70+
71+
return AnchorStore.create(updateOptions);
6972
}
7073

7174
export function joinHostPort(address: Address | null): string {

0 commit comments

Comments
 (0)