Skip to content

Commit

Permalink
integrate support for chain code as a service remote execution
Browse files Browse the repository at this point in the history
  • Loading branch information
rlfnb committed Sep 28, 2024
1 parent 94590aa commit 01d340b
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
6 changes: 3 additions & 3 deletions ccaas_builder/cmd/detect/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@ func main() {
logger.Printf("::Error: %v\n", err)
os.Exit(1)
}

logger.Printf("::Type detected as ccaas")
}

type chaincodeMetadata struct {
Expand Down Expand Up @@ -59,10 +57,12 @@ func run() error {
return errors.WithMessage(err, "Unable to parse the metadata.json file")
}

if strings.ToLower(metadata.Type) != "ccaas" {
if strings.ToLower(metadata.Type) != "ccaas" && strings.ToLower(metadata.Type) != "remote" {
return fmt.Errorf("chaincode type not supported: %s", metadata.Type)
}

logger.Printf("::Type detected as: " + strings.ToLower(metadata.Type))

// returning nil indicates to the peer a successful detection
return nil
}
4 changes: 4 additions & 0 deletions ccaas_builder/cmd/detect/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ func TestArugments(t *testing.T) {
exitCode: 0,
args: []string{"na", "testdata/validtype"},
},
"validremote": {
exitCode: 0,
args: []string{"na", "testdata/validremote"},
},
"wrongtype": {
exitCode: 1,
args: []string{"na", "testdata/wrongtype"},
Expand Down
4 changes: 4 additions & 0 deletions ccaas_builder/cmd/detect/testdata/validremote/metadata.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"type": "remote",
"label": "audit-trail"
}

0 comments on commit 01d340b

Please sign in to comment.