Hyperledger Composer REST Server
The Hyperledger Composer REST server, composer-rest-server, can be used to generate a REST API from a deployed blockchain business network that can be easily consumed by HTTP or REST clients.
Configuring the REST server using environment variables
The REST server can be configured using environment variables, instead of supplying configuration options via the command line. The REST server supports the following environment variables:
COMPOSER_CARDYou can use the
COMPOSER_CARDenvironment variable to specify the name of the discovery business network card that the REST server should use to connect to the business network.For example:
COMPOSER_CARD=admin@my-networkCOMPOSER_NAMESPACESYou can use the
COMPOSER_NAMESPACESenvironment variable to specify if the REST server should generate a REST API with namespaces or not. Valid values arealways,required, andnever.For example:
COMPOSER_NAMESPACES=neverCOMPOSER_AUTHENTICATIONYou can use the
COMPOSER_AUTHENTICATIONenvironment variable to specify if the REST server should enable REST API authentication or not. Valid values aretrueandfalse.For example:
COMPOSER_AUTHENTICATION=trueFor more information, see Enabling authentication for the REST server.
COMPOSER_MULTIUSERYou can use the
COMPOSER_MULTIUSERenvironment variable to specify if the REST server should enable multiple user mode or not. Valid values aretrueandfalse.For example:
COMPOSER_MULTIUSER=trueFor more information, see Enabling multiple user mode for the REST server.
COMPOSER_PROVIDERSYou can use the
COMPOSER_PROVIDERSenvironment variable to specify the Passport strategies that the REST server should use to authenticate clients of the REST API.For example:
COMPOSER_PROVIDERS='{ "github": { "provider": "github", "module": "passport-github", "clientID": "REPLACE_WITH_CLIENT_ID", "clientSecret": "REPLACE_WITH_CLIENT_SECRET", "authPath": "/auth/github", "callbackURL": "/auth/github/callback", "successRedirect": "/", "failureRedirect": "/" } }'COMPOSER_DATASOURCESYou can use the
COMPOSER_DATASOURCESenvironment variable to specify the LoopBack data sources and the connection information required by the selected LoopBack connector.For example:
COMPOSER_DATASOURCES='{ "db": { "name": "db", "connector": "mongodb", "host": "mongo" } }'COMPOSER_TLSYou can use the
COMPOSER_TLSenvironment variable to specify if the REST server should enable HTTPS and TLS. Valid values aretrueandfalse.For example:
COMPOSER_TLS=trueFor more information, see Securing the REST server using HTTPS and TLS.
COMPOSER_TLS_CERTIFICATEYou can use the
COMPOSER_TLS_CERTIFICATEenvironment variable to specify the certificate file that the REST server should use when HTTPS and TLS are enabled.For example:
COMPOSER_TLS_CERTIFICATE=/tmp/cert.pemCOMPOSER_TLS_KEYYou can use the
COMPOSER_TLS_KEYenvironment variable to specify the private key file that the REST server should use when HTTPS and TLS are enabled.For example:
COMPOSER_TLS_KEY=/tmp/key.pem