mirror of
https://github.com/corda/corda.git
synced 2025-02-05 18:49:14 +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
|
get() = networkMapValue
|
||||||
set(value) { networkMapValue = value }
|
set(value) { networkMapValue = value }
|
||||||
|
|
||||||
private val userMap: Map<String, String>
|
private val userMap: Map<String, Any>
|
||||||
val user: Map<String, String>
|
val user: Map<String, Any>
|
||||||
get() = userMap
|
get() = userMap
|
||||||
|
|
||||||
val ssl: SSLConfiguration = object : SSLConfiguration {
|
val ssl: SSLConfiguration = object : SSLConfiguration {
|
||||||
@ -50,10 +50,24 @@ class NodeConfig(
|
|||||||
.withValue("h2port", valueFor(h2Port))
|
.withValue("h2port", valueFor(h2Port))
|
||||||
.withValue("useTestClock", valueFor(true))
|
.withValue("useTestClock", valueFor(true))
|
||||||
|
|
||||||
|
val isCashIssuer : Boolean
|
||||||
|
get() {
|
||||||
|
extraServices.forEach {
|
||||||
|
if (it.startsWith("corda.issuer.")) {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
init {
|
init {
|
||||||
userMap = mapOf(
|
userMap = mapOf<String, Any>(
|
||||||
Pair("password", "letmein"),
|
Pair<String, Any>("password", "letmein"),
|
||||||
Pair("user", "guest")
|
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 FIRST_PORT = 10000
|
||||||
|
|
||||||
private val baseDir = Paths.get("work", localDir).toAbsolutePath()
|
private val baseDir = Paths.get("work", localDir).toAbsolutePath()
|
||||||
|
private val pluginDir = Paths.get("plugins").toAbsolutePath()
|
||||||
private val jvm by inject<JVMConfig>()
|
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 cordaPath = Paths.get("corda", "corda.jar").toAbsolutePath()
|
||||||
private val command = jvm.commandFor(cordaPath)
|
private val command = jvm.commandFor(cordaPath)
|
||||||
|
|
||||||
@ -73,11 +76,18 @@ class NodeController : Controller() {
|
|||||||
|
|
||||||
if (nodeDir.mkdirs()) {
|
if (nodeDir.mkdirs()) {
|
||||||
try {
|
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 confFile = nodeDir.resolve("node.conf")
|
||||||
val fileData = config.toFileConfig
|
val fileData = config.toFileConfig
|
||||||
confFile.writeText(fileData.root().render(renderOptions))
|
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())
|
pty.run(command, System.getenv(), nodeDir.toString())
|
||||||
log.info("Launched node: " + config.legalName)
|
log.info("Launched node: " + config.legalName)
|
||||||
return true
|
return true
|
||||||
|
@ -24,7 +24,8 @@ class NodeRPC(config: NodeConfig, invoke: (ops: CordaRPCOps) -> Unit): AutoClose
|
|||||||
val setupTask = object : TimerTask() {
|
val setupTask = object : TimerTask() {
|
||||||
override fun run() {
|
override fun run() {
|
||||||
try {
|
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()
|
val ops = rpcClient.proxy()
|
||||||
|
|
||||||
// Cancel the "setup" task now that we've created the RPC client.
|
// 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 net.corda.demobench.ui.PropertyLabel
|
||||||
import tornadofx.Fragment
|
import tornadofx.Fragment
|
||||||
import tornadofx.vgrow
|
import tornadofx.vgrow
|
||||||
import java.util.*
|
|
||||||
|
|
||||||
class NodeTerminalView : Fragment() {
|
class NodeTerminalView : Fragment() {
|
||||||
override val root by fxml<VBox>()
|
override val root by fxml<VBox>()
|
||||||
@ -82,7 +81,7 @@ class NodeTerminalView : Fragment() {
|
|||||||
val statesInVault = ops.vaultAndUpdates()
|
val statesInVault = ops.vaultAndUpdates()
|
||||||
val cashBalances = ops.getCashBalances().entries.joinToString(
|
val cashBalances = ops.getCashBalances().entries.joinToString(
|
||||||
separator = ", ",
|
separator = ", ",
|
||||||
transform = { e -> "%s %s".format(e.value, e.key.currencyCode) }
|
transform = { e -> e.value.toString() }
|
||||||
)
|
)
|
||||||
|
|
||||||
Platform.runLater {
|
Platform.runLater {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user