I want add a configuration file that includes parameters like network name in a configuration file that the chaincode can read from and I can edit without reinstalling/instantiating the chaincode. Is this possible?
I have tried creating a config.properties files in the root project folder. I have the following code.
try{
FileInputStream ip= new FileInputStream("config.properties");
prop.load(ip);
System.out.println(prop.getProperty("network"));
} catch (Exception e) {
System.out.println("properties file not found");
}
When running the chaincode unit tests I can see that the properties file are accessible and the value of network key is printed. When I deploy and go inside container logs, properties file not found
is printed instead.
I did the following in my terminal and it reads the file.
docker cp config.properties dev-peer0.org1.com-mycc-1.0:config.properties
Is there a better way to do this? Or should I avoid reading from properties file since chaincode is not supposed to do any io operation.