mirror of
https://github.com/corda/corda.git
synced 2025-02-20 17:33:15 +00:00
Merged in clint-rpcuserscordform (pull request #554)
Added RPC user configuration block
This commit is contained in:
commit
8119a343fe
@ -2,6 +2,7 @@ buildscript {
|
||||
// Our version: bump this on release.
|
||||
ext.corda_version = "0.6-SNAPSHOT"
|
||||
|
||||
ext.gradle_plugins_version = "0.5.5"
|
||||
ext.kotlin_version = '1.0.5'
|
||||
ext.quasar_version = '0.7.6'
|
||||
ext.asm_version = '0.5.3'
|
||||
@ -26,9 +27,9 @@ buildscript {
|
||||
dependencies {
|
||||
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
||||
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.4'
|
||||
classpath 'net.corda.plugins:publish-utils:0.5'
|
||||
classpath 'net.corda.plugins:quasar-utils:0.5.2'
|
||||
classpath 'net.corda.plugins:cordformation:0.5.3'
|
||||
classpath "net.corda.plugins:publish-utils:$gradle_plugins_version"
|
||||
classpath "net.corda.plugins:quasar-utils:$gradle_plugins_version"
|
||||
classpath "net.corda.plugins:cordformation:$gradle_plugins_version"
|
||||
|
||||
// Can run 'gradle dependencyUpdates' to find new versions of things.
|
||||
classpath 'com.github.ben-manes:gradle-versions-plugin:0.12.0'
|
||||
|
@ -144,6 +144,7 @@ To build against Corda and the plugins that cordapps use, update your build.grad
|
||||
|
||||
buildscript {
|
||||
ext.corda_version = '<enter the corda version you build against here>'
|
||||
ext.corda_gradle_plugins_version = '<enter the gradle plugins version here>' // This is usually the same as corda_version.
|
||||
... your buildscript ...
|
||||
|
||||
repositories {
|
||||
@ -153,9 +154,9 @@ To build against Corda and the plugins that cordapps use, update your build.grad
|
||||
|
||||
dependencies {
|
||||
... your dependencies ...
|
||||
classpath "net.corda.plugins:cordformation:$corda_version"
|
||||
classpath "net.corda.plugins:quasar-utils:$corda_version"
|
||||
classpath "net.corda.plugins:publish-utils:$corda_version"
|
||||
classpath "net.corda.plugins:cordformation:$corda_gradle_plugins_version"
|
||||
classpath "net.corda.plugins:quasar-utils:$corda_gradle_plugins_version"
|
||||
classpath "net.corda.plugins:publish-utils:$corda_gradle_plugins_version"
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2,8 +2,7 @@
|
||||
// or if you are developing these plugins. See the readme for more information.
|
||||
|
||||
buildscript {
|
||||
// Our version: bump this on release.
|
||||
ext.corda_version = "0.6-SNAPSHOT"
|
||||
ext.gradle_plugins_version = "0.5.5" // Our version: bump this on release.
|
||||
ext.corda_published_version = "0.5" // Depend on our existing published publishing plugin.
|
||||
|
||||
repositories {
|
||||
@ -19,8 +18,8 @@ buildscript {
|
||||
apply plugin: 'maven-publish'
|
||||
|
||||
allprojects {
|
||||
version "$gradle_plugins_version"
|
||||
group 'net.corda'
|
||||
version "$corda_version"
|
||||
}
|
||||
|
||||
subprojects {
|
||||
|
@ -1,13 +1,10 @@
|
||||
package net.corda.plugins
|
||||
|
||||
import com.typesafe.config.Config
|
||||
import com.typesafe.config.ConfigFactory
|
||||
import com.typesafe.config.ConfigRenderOptions
|
||||
import com.typesafe.config.ConfigValueFactory
|
||||
import com.typesafe.config.*
|
||||
import org.gradle.api.Project
|
||||
|
||||
import java.nio.charset.StandardCharsets
|
||||
import java.nio.file.Files
|
||||
|
||||
/**
|
||||
* Represents a node that will be installed.
|
||||
*/
|
||||
@ -30,10 +27,18 @@ class Node {
|
||||
* @note Your app will be installed by default and does not need to be included here.
|
||||
*/
|
||||
protected List<String> cordapps = []
|
||||
/**
|
||||
* Set the RPC users for this node. This configuration block allows arbitrary configuration.
|
||||
* The recommended current structure is:
|
||||
* [[['user': "username_here", 'password': "password_here", 'permissions': ["permissions_here"]]]
|
||||
* The above is a list to a map of keys to values using Groovy map and list shorthands.
|
||||
*
|
||||
* @note Incorrect configurations will not cause a DSL error.
|
||||
*/
|
||||
protected List<Map<String, Object>> rpcUsers = []
|
||||
|
||||
private String dirName
|
||||
private Config config = ConfigFactory.empty()
|
||||
//private Map<String, Object> config = new HashMap<String, Object>()
|
||||
private File nodeDir
|
||||
private Project project
|
||||
|
||||
@ -122,6 +127,7 @@ class Node {
|
||||
*/
|
||||
void build(File baseDir) {
|
||||
nodeDir = new File(baseDir, dirName)
|
||||
configureRpcUsers()
|
||||
installCordaJAR()
|
||||
installBuiltPlugin()
|
||||
installCordapps()
|
||||
@ -138,6 +144,13 @@ class Node {
|
||||
return config.getString("artemisAddress")
|
||||
}
|
||||
|
||||
/**
|
||||
* Write the RPC users to the config
|
||||
*/
|
||||
private void configureRpcUsers() {
|
||||
config = config.withValue("rpcUsers", ConfigValueFactory.fromIterable(rpcUsers))
|
||||
}
|
||||
|
||||
/**
|
||||
* Installs the corda fat JAR to the node directory.
|
||||
*/
|
||||
@ -213,8 +226,10 @@ class Node {
|
||||
* @return A file representing the Corda JAR.
|
||||
*/
|
||||
private File verifyAndGetCordaJar() {
|
||||
def maybeCordaJAR = project.configurations.runtime.filter { it.toString().contains("corda-${project.corda_version}.jar")}
|
||||
if(maybeCordaJAR.size() == 0) {
|
||||
def maybeCordaJAR = project.configurations.runtime.filter {
|
||||
it.toString().contains("corda-${project.corda_version}.jar")
|
||||
}
|
||||
if (maybeCordaJAR.size() == 0) {
|
||||
throw new RuntimeException("No Corda Capsule JAR found. Have you deployed the Corda project to Maven? Looked for \"corda-${project.corda_version}.jar\"")
|
||||
} else {
|
||||
def cordaJar = maybeCordaJAR.getSingleFile()
|
||||
|
Loading…
x
Reference in New Issue
Block a user