From 4aabeb39a6a81c56b9ae5032cdaa65bb3ece323f Mon Sep 17 00:00:00 2001 From: Simon Stone Date: Mon, 8 Feb 2021 10:28:58 +0000 Subject: [PATCH] Store admin identity on file system (resolves #13) (#74) Signed-off-by: Simon Stone --- internal/app/microfabd/microfabd.go | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/internal/app/microfabd/microfabd.go b/internal/app/microfabd/microfabd.go index f0bb1f1..d227060 100644 --- a/internal/app/microfabd/microfabd.go +++ b/internal/app/microfabd/microfabd.go @@ -30,6 +30,7 @@ import ( "github.com/IBM-Blockchain/microfab/internal/pkg/organization" "github.com/IBM-Blockchain/microfab/internal/pkg/peer" "github.com/IBM-Blockchain/microfab/internal/pkg/proxy" + "github.com/IBM-Blockchain/microfab/internal/pkg/util" "github.com/IBM-Blockchain/microfab/pkg/client" "github.com/hyperledger/fabric-protos-go/common" "golang.org/x/net/context" @@ -398,6 +399,13 @@ func (m *Microfab) createOrderingOrganization(config Organization) error { if err != nil { return err } + organizationName := organization.Name() + lowerOrganizationName := strings.ToLower(organizationName) + adminDirectory := path.Join(m.config.Directory, fmt.Sprintf("admin-%s", lowerOrganizationName)) + err = util.CreateMSPDirectory(adminDirectory, organization.Admin()) + if err != nil { + return err + } m.Lock() m.ordererOrganization = organization m.Unlock() @@ -422,6 +430,13 @@ func (m *Microfab) createEndorsingOrganization(config Organization) error { if err != nil { return err } + organizationName := organization.Name() + lowerOrganizationName := strings.ToLower(organizationName) + adminDirectory := path.Join(m.config.Directory, fmt.Sprintf("admin-%s", lowerOrganizationName)) + err = util.CreateMSPDirectory(adminDirectory, organization.Admin()) + if err != nil { + return err + } m.Lock() m.endorsingOrganizations = append(m.endorsingOrganizations, organization) m.Unlock()