stage(‘Re-writing the paths in customHTML.js based on the Environment we choosed’) {
steps {
script {
catchError{
// Deleting the old customHTML.js file in the cloned project
if (params.ENVIRONMENT == ‘Stability’) {
sh '''
sed -i -e 's#var serverPath="http://weconnect.wenzins.live:9090/fitkitapi";#var serverPath="http://stability.wenzins.live:9090/fitkitapi";#' \
-e 's#var doctorWebPath="http://weconnect.wenzins.live:8080/fDoctorWeb";#var doctorWebPath="http://stability.wenzins.live:8080/fDoctorWeb";#' \
-e 's#var imagePath="http://weconnect.wenzins.live:8080/image/phc";#var imagePath="http://stability.wenzins.live:8080/image/phc";##' \
-e 's#var urlPath = "http://weconnect.wenzins.live:8080/image/phc";#var urlPath = "http://stability.wenzins.live:8080/image/phc";#' /opt/jenkins/workspace/fDoctorWeb/src/main/webapp/resources/js/customHTML.js
'''
}
// Copying the replacement files
else if(params.ENRIVONMENT == 'Weconnect') {
sh '''
sed -i -e 's#var serverPath="http://weconnect.wenzins.live:9090/fitkitapi";#var serverPath="http://weconnect.wenzins.live:9090/fitkitapi";#' \
-e 's#var doctorWebPath="http://weconnect.wenzins.live:8080/fDoctorWeb";#var doctorWebPath="http://weconnect.wenzins.live:8080/fDoctorWeb";#' \
-e 's#var imagePath="http://weconnect.wenzins.live:8080/image/phc";#var imagePath="http://weconnect.wenzins.live:8080/image/phc";##' \
-e 's#var urlPath = "http://weconnect.wenzins.live:8080/image/phc";#var urlPath = "http://weconnect.wenzins.live:8080/image/phc";#' /opt/jenkins/workspace/fDoctorWeb/src/main/webapp/resources/js/customHTML.js
'''
}
else {
echo "Check Config"
}
}
}
}
}