mirror of
https://github.com/corda/corda.git
synced 2025-01-14 16:59:52 +00:00
Grant permissions to the Node's user, and install BanfOfCorda plugin for cash issuers.
This commit is contained in:
parent
c7281a077f
commit
534e8a01a2
@ -25,8 +25,8 @@ class NodeConfig(
|
||||
get() = networkMapValue
|
||||
set(value) { networkMapValue = value }
|
||||
|
||||
private val userMap: Map<String, String>
|
||||
val user: Map<String, String>
|
||||
private val userMap: Map<String, Any>
|
||||
val user: Map<String, Any>
|
||||
get() = userMap
|
||||
|
||||
val ssl: SSLConfiguration = object : SSLConfiguration {
|
||||
@ -50,10 +50,24 @@ class NodeConfig(
|
||||
.withValue("h2port", valueFor(h2Port))
|
||||
.withValue("useTestClock", valueFor(true))
|
||||
|
||||
val isCashIssuer : Boolean
|
||||
get() {
|
||||
extraServices.forEach {
|
||||
if (it.startsWith("corda.issuer.")) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
init {
|
||||
userMap = mapOf(
|
||||
Pair("password", "letmein"),
|
||||
Pair("user", "guest")
|
||||
userMap = mapOf<String, Any>(
|
||||
Pair<String, Any>("password", "letmein"),
|
||||
Pair<String, Any>("user", "guest"),
|
||||
Pair<String, Any>("permissions", listOf(
|
||||
"StartFlow.net.corda.flows.CashFlow",
|
||||
"StartFlow.net.corda.flows.IssuerFlow\$IssuanceRequester"
|
||||
))
|
||||
)
|
||||
}
|
||||
|
||||
|
@ -14,8 +14,11 @@ class NodeController : Controller() {
|
||||
private val FIRST_PORT = 10000
|
||||
|
||||
private val baseDir = Paths.get("work", localDir).toAbsolutePath()
|
||||
private val pluginDir = Paths.get("plugins").toAbsolutePath()
|
||||
private val jvm by inject<JVMConfig>()
|
||||
|
||||
private val bankOfCorda = pluginDir.resolve("bank-of-corda.jar").toFile()
|
||||
|
||||
private val cordaPath = Paths.get("corda", "corda.jar").toAbsolutePath()
|
||||
private val command = jvm.commandFor(cordaPath)
|
||||
|
||||
@ -73,11 +76,18 @@ class NodeController : Controller() {
|
||||
|
||||
if (nodeDir.mkdirs()) {
|
||||
try {
|
||||
// Write this nodes configuration file into its working directory.
|
||||
// Write this node's configuration file into its working directory.
|
||||
val confFile = nodeDir.resolve("node.conf")
|
||||
val fileData = config.toFileConfig
|
||||
confFile.writeText(fileData.root().render(renderOptions))
|
||||
|
||||
// Nodes cannot issue cash unless they contain the "Bank of Corda" plugin.
|
||||
if (config.isCashIssuer && bankOfCorda.isFile()) {
|
||||
log.info("Installing 'Bank of Corda' plugin")
|
||||
bankOfCorda.copyTo(nodeDir.resolve("plugins").resolve(bankOfCorda.name))
|
||||
}
|
||||
|
||||
// Execute the Corda node
|
||||
pty.run(command, System.getenv(), nodeDir.toString())
|
||||
log.info("Launched node: " + config.legalName)
|
||||
return true
|
||||
|
@ -24,7 +24,8 @@ class NodeRPC(config: NodeConfig, invoke: (ops: CordaRPCOps) -> Unit): AutoClose
|
||||
val setupTask = object : TimerTask() {
|
||||
override fun run() {
|
||||
try {
|
||||
rpcClient.start(config.user.getOrElse("user") { "none" }, config.user.getOrElse("password") { "none" })
|
||||
rpcClient.start(config.user.getOrElse("user") { "none" } as String,
|
||||
config.user.getOrElse("password") { "none" } as String)
|
||||
val ops = rpcClient.proxy()
|
||||
|
||||
// Cancel the "setup" task now that we've created the RPC client.
|
||||
|
@ -17,7 +17,6 @@ import net.corda.demobench.rpc.NodeRPC
|
||||
import net.corda.demobench.ui.PropertyLabel
|
||||
import tornadofx.Fragment
|
||||
import tornadofx.vgrow
|
||||
import java.util.*
|
||||
|
||||
class NodeTerminalView : Fragment() {
|
||||
override val root by fxml<VBox>()
|
||||
@ -82,7 +81,7 @@ class NodeTerminalView : Fragment() {
|
||||
val statesInVault = ops.vaultAndUpdates()
|
||||
val cashBalances = ops.getCashBalances().entries.joinToString(
|
||||
separator = ", ",
|
||||
transform = { e -> "%s %s".format(e.value, e.key.currencyCode) }
|
||||
transform = { e -> e.value.toString() }
|
||||
)
|
||||
|
||||
Platform.runLater {
|
||||
|
Loading…
Reference in New Issue
Block a user