Reputation: 2251
I have tokens in the file in a bash format looking something like this:
PASSWORD=$PASSWORD
How can I change ReplaceTokens filter so that it would respect the bash format?
copy{
into something
from somethingelse
filter(ReplaceTokens, tokens: [PASSWORD:'123456'])
}
Upvotes: 0
Views: 1089
Reputation: 6203
ReplaceTokens supports a begin and end token, so you could do this:
filter( ReplaceTokens,
beginToken : '$',
endToken : '',
tokens: [PASSWORD:'123456']
)
Upvotes: 1
Reputation: 2251
The solution is to use expand property of a copy task:
task copyProductionConfig(type: Copy) {
from 'source'
include 'config.properties'
into 'build/war/WEB-INF/config'
expand([
databaseHostname: 'db.company.com',
version: versionId,
buildNumber: (int)(Math.random() * 1000),
date: new Date()
])
}
Upvotes: 0