'use strict'
const { Shim } = require('fabric-shim')
const path=require("path")
const fs=require('fs')
const examplecc = require('./lib/examplecontract.js')
function main(){
const tlsCertsPath=path.resolve(__dirname,"lib", "tls")
const tlsKey = fs.readFileSync( path.resolve(tlsCertsPath, "server.key"))
const tlsCert = fs.readFileSync(path.resolve(tlsCertsPath, "server.crt"))
const rootCert = fs.readFileSync(path.resolve(tlsCertsPath, "ca.crt"))
const config={
ccid:
"examplecc:1177322ea1cb10e56c4499016dsdb2fbf0be155660e97a38ca48de76326b12362",
address: "0.0.0.0:9992"}
const server= Shim.server(new examplecc(),{
ccid: config.ccid,
address: config.address,
tlsProps: {
disabled: true,
key: tlsKey,
cert: tlsCert,
clientCACerts: rootCert,
}
} )
server.start().then((res)=>{
console.log("Server running successfully @" + config.address )
})
}
main()