Skip to content

Commit

Permalink
[FAB-17574] Support adding an application org to a channel config
Browse files Browse the repository at this point in the history
Description

Modify an existing channel configuration to add an application org.

Related issues

https://jira.hyperledger.org/browse/FAB-17574

Signed-off-by: xu wu <[email protected]>
  • Loading branch information
wuxuer authored and sykesm committed Mar 23, 2020
1 parent 25b268e commit 0e178b4
Show file tree
Hide file tree
Showing 3 changed files with 495 additions and 1 deletion.
15 changes: 15 additions & 0 deletions pkg/config/application.go
Original file line number Diff line number Diff line change
Expand Up @@ -209,3 +209,18 @@ func getApplicationOrg(config *cb.Config, orgName string) (*cb.ConfigGroup, erro
}
return org, nil
}

// AddApplicationOrg adds an organization to an existing config's Application configuration.
// Will not error if organization already exists.
func AddApplicationOrg(config *cb.Config, org Organization) error {
appGroup := config.ChannelGroup.Groups[ApplicationGroupKey]

orgGroup, err := newOrgConfigGroup(org)
if err != nil {
return fmt.Errorf("failed to create application org %s: %v", org.Name, err)
}

appGroup.Groups[org.Name] = orgGroup

return nil
}
Loading

0 comments on commit 0e178b4

Please sign in to comment.