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