This content has been marked as final.
Show 1 reply
-
1. Re: Externalize values used in a CLI script to a separate file
codergeek Apr 8, 2015 10:39 AM (in response to codergeek)I have found a solution to this problem: jboss-cli has an option called "--properties" that is not displayed in the help message. This option can be used to pass a property file to the CLI. The properties from this file have to be assigned to CLI variables before they can be used.
Taking the example from above:
dbConfig.properties:
dbUrl=jdbc:mysql://localhost:3306/myDB dbUsername=myUser dbPasswd=myPasswd
createDataSource.cli:
set url=${dbUrl} set username=${dbUsername} set password=${dbPasswd} data-source add --name=myDS \ --jndi-name=java:jboss/datasources/myDS \ --driver-class=com.mysql.jdbc.Driver \ --driver-name=mysql-connector-java-5.1.35-bin.jar \ --connection-url=$url \ --user-name=$username \ --password=$password
Execute script:
jboss-cli -c --properties=dbConfig.properties --file=createDataSource.cli