1、概要

部署开发与生产环境,有用到flowable工作流的地方,每次部署,需要修改war包里面的配置,最多的就是引擎的地址和数据库的地址、端口,账密等信息。次数多了,修改这些体力活。

使用shell改进这个工作。

1.1、思路

  • 获得flowable的release包 && 解压 && 进入解压的文件夹 && 进入war包所在位置;
  • 解压war包 && 删除原来的配置文件 && 创建新的配置文件;
  • 提示用户输入信息(不输入会有默认并提示) && 最后确认;
  • 如果有问题,则输入n,并输入相对应的需要进行修正;
  • 如果正确,则输入y,将用户输入的信息写入配置文件 && 打包war包;
  • 结束

2、使用与实现

我下载的flowable-6.3.0.zip,在使用的时候,保证脚本与这个压缩包在同一目录下即可。

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031

#!/usr/bin/env bash
# https://youxiu.net/

# Semi-automated deployment flowable
# 2020.01.31
# This script needs to be in the same parent directory as the folder
# This script needs to be in the same parent directory as the folder
# This script needs to be in the same parent directory as the folder
# This script needs to be in the same parent directory as the folder

PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin
export PATH

# define a group color
red='\033[0;31m'
green='\033[0;32m'
yellow='\033[0;33m'
plain='\033[0m'

# by root
[[ $EUID -ne 0 ]] && echo -e "[${red}Error${plain}] This script must be run as root!" && exit 1

# I get a compressed package

CURDIR=$(
cd $(dirname ${BASH_SOURCE[0]})
pwd
)

rm -rf flowable-6.3.0
unzip flowable-6.3.0.zip

cd $CURDIR/flowable-6.3.0

echo "Go into the folder and create a folder"
cd wars
mkdir flowable-admin && mv flowable-admin.war flowable-admin
mkdir flowable-idm && mv flowable-idm.war flowable-idm
mkdir flowable-modeler && mv flowable-modeler.war flowable-modeler
mkdir flowable-rest && mv flowable-rest.war flowable-rest
mkdir flowable-task && mv flowable-task.war flowable-task

echo "Folder created and processed successfully"
cd flowable-admin && jar -xvf flowable-admin.war
echo "flowable-admin.war unzip successfully"

# come back
cd ..

cd flowable-idm && jar -xvf flowable-idm.war
echo "flowable-idm.war unzip successfully"

# come back
cd ..

cd flowable-modeler && jar -xvf flowable-modeler.war
echo "flowable-modeler.war unzip successfully"

# come back
cd ..

cd flowable-rest && jar -xvf flowable-rest.war
echo "flowable-rest.war unzip successfully"

# come back
cd ..

cd flowable-task && jar -xvf flowable-task.war
echo "flowable-task.war unzip successfully"

# back to ../wars/
cd ..

: <<!
As the custom properties in the application.properties file cannot be controlled,
the processing method here is to delete the original file,
create a new file,
and obtain the necessary properties from the user input.
!

# current dir2
# CURDIR2=$(cd $(dirname ${BASH_SOURCE[0]}); pwd )

# echo $CURDIR2
#----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------#
#----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------#
#---------------------------------------------------------------------------------------flowable-admin-----------------------------------------------------------------------------------------------------#
#----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------#
#----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------#
# have an application.properties
#
#
cd flowable-admin/WEB-INF/classes
rm -rf application.properties
touch application1.properties

echo -n "[1]please input the server.port = ? (default is 9988)"
read port
if [[ $port == "" ]]; then
port='9988'
fi

echo -n "your server.port is $port"

echo -n "[2]please input the context-path = ? (default is /flowable-admin)"
read contextPath
if [[ $contextPath == "" ]]; then
contextPath='/flowable-admin'
fi

echo -n "[3]please input the jmx.unique-names = ? (default is true)"
read jmxUniqueNames
if [[ $jmxUniqueNames == "" ]]; then
jmxUniqueNames='true'
fi

echo -n "[4]please input the proxy-target-class = ? (default is true)"
read proxyTargetClass
if [[ $proxyTargetClass ]]; then
proxyTargetClass='true'
fi

echo -n "[5]please input the spring.aop.auto = ? (default is true)"
read auto
if [[ $auto == "" ]]; then
auto='true'
fi

echo -n "[6]please input the spring.application.name = ? (default is flowable-ui-admin)"
read applicationName
if [[ $applicationName == "" ]]; then
applicationName='flowable-ui-admin'
fi

echo -n "[7]please input the liquibase.enabled = ? (default is false!!!)"
read liquibaseEnabled
if [[ $liquibaseEnabled == "" ]]; then
liquibaseEnabled='false'
fi

echo -n "[8]please input the servlet.multipart.max-file-size = ? (default is 10MB)"
read multipartMaxFileSize
if [[ $multipartMaxFileSize == "" ]]; then
multipartMaxFileSize='10MB'
fi

echo -n "[9]please input the spring.banner.location = ? (default is classpath:/org/flowable/spring/boot/flowable-banner.txt)"
read bannerLocation
if [[ $bannerLocation == "" ]]; then
bannerLocation='classpath:/org/flowable/spring/boot/flowable-banner.txt'
fi

echo -n "[10]please input the management.endpoints.web.exposure.include = ? (default is *)"
read webExposureInclude
if [[ $webExposureInclude == "" ]]; then
webExposureInclude='*'
fi

echo -n "[11]please input the management.endpoint.health.show-details = ? (default is when_authorized) "
read healthShowDeails
if [[ $healthShowDeails == "" ]]; then
healthShowDeails='when_authorized'
fi

echo -n "[12]please input management.endpoint.health.roles = ? (default is access-admin)"
read healthRoles
if [[ $healthRoles == "" ]]; then
healthRoles='access-admin'
fi

echo -n "[13]please input the MySQL server host ip = ? (default is 127.0.0.1)"
read MySQLHostIp
if [[ $MySQLHostIp == "" ]]; then
MySQLHostIp='127.0.0.1'
fi

echo -n "[14]please input the MySQL server host port = ? (default is 3306)"
read MySQLHostPort
if [[ $MySQLHostPort == "" ]]; then
MySQLHostPort='3306'
fi

echo -n "[15]please input the MySQL database name = ? (default is flowable)"
read datasourceName
if [[ $datasourceName == "" ]]; then
datasourceName='flowable'
fi

echo -n "[16]please input the MySQL database character encoding name = ? (default is UTF-8)"
read characterEncoding
if [[ $characterEncoding == "" ]]; then
characterEncoding='UTF-8'
fi

echo -n "[17]please input the spring.datasource.username = ? (default is root)"
read datasourceUsername
if [[ $datasourceUsername == "" ]]; then
datasourceUsername='root'
fi

echo -n "[18]please input the spring.datasource.password = ? (default is 123456)"
read datasourcePassword
if [[ $datasourcePassword == "" ]]; then
datasourcePassword='123456'
fi

# Process engine Info

echo -n "[19]please input the server-config.process.name = ? (default is Flowable Process app)"
read processName
if [[ $processName == "" ]]; then
processName='Flowable Process app'
fi

echo -n "[20]please input the server-config.process.description = ? (default is Flowable Process REST config)"
read processDescription
if [[ $processDescription == "" ]]; then
processDescription='Flowable Process REST config'
fi

echo -n "[21]please input the server-config.process.server-address = ? (default is http://localhost)"
read processServerAddress
if [[ $processServerAddress == "" ]]; then
processServerAddress='http://localhost'
fi

echo -n "[22]please input the server-config.process.port = ? (default is 8080)"
read processPort
if [[ $processPort == "" ]]; then
processPort='8080'
fi

echo -n "[23]please input the server-config.process.context-root = ? (default is flowable-task)"
read processContextRoot
if [[ $processContextRoot == "" ]]; then
processContextRoot='flowable-task'
fi

echo -n "[24]please input the server-config.process.rest-root = ? (default is process-api)"
read processRestRoot
if [[ $processRestRoot == "" ]]; then
processRestRoot='process-api'
fi

echo -n "[25]please input the server-config.process.user-name = ? (default is admin)"
read processUserName
if [[ $processUserName == "" ]]; then
processUserName='admin'
fi

echo -n "[26]please input the server-config.process.password = ? (default is test)"
read processPassword
if [[ $processPassword == "" ]]; then
processPassword='test'
fi

# CMMN engine

echo -n "[27]please input the server-config.cmmn.name = ? (default is Flowable CMMN app)"
read cmmnName
if [[ $cmmnName == "" ]]; then
cmmnName='Flowable CMMN app'
fi

echo -n "[28]please input the server-config.cmmn.description = ? (default is Flowable CMMN REST config)"
read cmmnDescription
if [[ $cmmnDescription == "" ]]; then
cmmnDescription='Flowable CMMN REST config'
fi

echo -n "[29]please input the server-config.cmmn.server-address = ? (default is http://localhost)"
read cmmnServerAddress
if [[ $cmmnServerAddress == "" ]]; then
cmmnServerAddress='http://localhost'
fi

echo -n "[30]please input the server-config.cmmn.port = ? (default is 8080)"
read cmmnPort
if [[ $cmmnPort == "" ]]; then
cmmnPort='8080'
fi

echo -n "[31]please input the server-config.cmmn.context-root = ? (default is flowable-task)"
read cmmnContextRoot
if [[ $cmmnContextRoot == "" ]]; then
cmmnContextRoot='flowable-task'
fi

echo -n "[32]please input the server-config.cmmn.rest-root = ? (default is cmmn-api)"
read cmmnRestRoot
if [[ $cmmnRestRoot == "" ]]; then
cmmnRestRoot='cmmn-api'
fi

echo -n "[33]please input the server-config.cmmn.user-name = ? (default is admin)"
read cmmnUserName
if [[ $cmmnUserName == "" ]]; then
cmmnUserName='admin'
fi

echo -n "[34]please input the server-config.cmmn.password = ? (default is test)"
read cmmnPassword
if [[ $cmmnPassword == "" ]]; then
cmmnPassword='test'
fi

# DMN engine

echo -n "[35]please input the server-config.dmn.name = ? (default is Flowable DMN app)"
read dmnName
if [[ $dmnName == "" ]]; then
dmnName='Flowable DMN app'
fi

echo -n "[36]please input the server-config.dmn.description = ? (default is Flowable DMN REST config)"
read dmnDescription
if [[ $dmnDescription == "" ]]; then
dmnDescription='Flowable DMN REST config'
fi

echo -n "[37]please input the server-config.dmn.server-address = ? (default is http://localhost)"
read dmnServerAddress
if [[ $dmnServerAddress == "" ]]; then
dmnServerAddress='http://localhost'
fi

echo -n "[38]please input the server-config.dmn.port = ? (default is 8080)"
read dmnPort
if [[ $dmnPort == "" ]]; then
dmnPort='8080'
fi

echo -n "[39]please input the server-config.dmn.context-root = ? (default is flowable-task)"
read dmnContextRoot
if [[ $dmnContextRoot == "" ]]; then
dmnContextRoot='flowable-task'
fi

echo -n "[40]please input the server-config.dmn.rest-root = ? (default is dmn-api)"
read dmnRestRoot
if [[ $dmnRestRoot == "" ]]; then
dmnRestRoot='dmn-api'
fi

echo -n "[41]please input the server-config.dmn.user-name = ? (default is admin)"
read dmnUserName
if [[ $dmnUserName == "" ]]; then
dmnUserName='admin'
fi

echo -n "[42]please input the server-config.dmn.password = ? (default is test)"
read dmnPassword
if [[ $dmnPassword == "" ]]; then
dmnPassword='test'
fi

# Form engine

echo -n "[43]please input the server-config.form.name = ? (default is Flowable Form app)"
read formName
if [[ $formName == "" ]]; then
formName='Flowable Form app'
fi

echo -n "[44]please input the server-config.form.description = ? (default is Flowable Form REST config)"
read formDescription
if [[ $formDescription == "" ]]; then
formDescription='Flowable Form REST config'
fi

echo -n "[45]please input the server-config.form.server-address = ? (default is http://localhost)"
read formServerAddress
if [[ $formServerAddress == "" ]]; then
formServerAddress='http://localhost'
fi

echo -n "[46]please input the server-config.form.port = ? (default is 8080)"
read formPort
if [[ $formPort == "" ]]; then
formPort='8080'
fi

echo -n "[47]please input the server-config.form.context-root = ? (default is flowable-task)"
read formContextRoot
if [[ $formContextRoot == "" ]]; then
formContextRoot='flowable-task'
fi

echo -n "[48]please input the server-config.form.rest-root = ? (default is form-api)"
read formRestRoot
if [[ $formRestRoot == "" ]]; then
formRestRoot='form-api'
fi

echo -n "[49]please input the server-config.form.user-name = ? (default is admin)"
read formUserName
if [[ $formUserName == "" ]]; then
formUserName='admin'
fi

echo -n "[50]please input the server-config.form.password = ? (default is test)"
read formPassword
if [[ $formPassword == "" ]]; then
formPassword='test'
fi

# Content engine

echo -n "[51]please input the server-config.content.name = ? (default is Flowable Content app)"
read contentName
if [[ $contentName == "" ]]; then
contentName='Flowable Content app'
fi

echo -n "[52]please input the server-config.content.description = ? (default is Flowable Content REST config)"
read contentDescription
if [[ $contentDescription == "" ]]; then
contentDescription='Flowable Content REST config'
fi

echo -n "[53]please input the server-config.content.server-address = ? (default is http://localhost)"
read contentServerAddress
if [[ $contentServerAddress == "" ]]; then
contentServerAddress='http://localhost'
fi

echo -n "[54]please input the server-config.content.port = ? (default is 8080)"
read contentPort
if [[ $contentPort == "" ]]; then
contentPort='8080'
fi

echo -n "[55]please input the server-config.content.context-root = ? (default is flowable-task)"
read contentContextRoot
if [[ $contentContextRoot == "" ]]; then
contentContextRoot='flowable-task'
fi

echo -n "[56]please input the server-config.content.rest-root = ? (default is content-api)"
read contentRestRoot
if [[ $contentRestRoot == "" ]]; then
contentRestRoot='content-api'
fi

echo -n "[57]please input the server-config.content.user-name = ? (default is admin)"
read contentUserName
if [[ $contentUserName == "" ]]; then
contentUserName='admin'
fi

echo -n "[58]please input the server-config.content.password = ? (default is test)"
read contentPassword
if [[ $contentPassword == "" ]]; then
contentPassword='test'
fi

# IDM Info

echo -n "[59]please input the flowable.common.app.idm-url.ip = ? (default is localhost)"
read appIdmUrlIp
if [[ $appIdmUrlIp == "" ]]; then
appIdmUrlIp='localhost'
fi

echo -n "[60]please input the flowable.common.app.idm-url.port = ? (default is 8080)"
read appIdmUrlPort
if [[ $appIdmUrlPort == "" ]]; then
appIdmUrlPort='8080'
fi

echo -n "[61]please input the flowable.common.app.idm-admin.user = ? (default is admin)"
read appIdmAdminUser
if [[ $appIdmAdminUser == "" ]]; then
appIdmAdminUser='admin'
fi

echo -n "[62]please input the flowable.common.app.idm-admin.password = ? (default is test)"
read appIdmAdminPassoword
if [[ $appIdmAdminPassoword == "" ]]; then
appIdmAdminPassoword='test'
fi

echo -n "confirm,if wrong, please choice 'n' to fix it !, input y/n:"

read flag
while [[ $flag == "n" ]]; do
echo 'input number 1 to 62'
echo 'your number is'
read aNum
case $aNum in
1)
echo 'number is 1, please fix your [port] current!'
read line1
port=$line1
;;
2)
echo 'number is 2, please fix your [context-path] current!'
read line2
contextPath=$line2
;;
3)
echo 'number is 3, please fix your [jmx.unique-names] current!'
read line3
jmxUniqueNames=$line3
;;
4)
echo 'number is 4, please fix your [proxy-target-class] current!'
read line4
proxyTargetClass=$line4
;;
5)
echo 'number is 5, please fix your [spring.aop.auto] current!'
read line5
auto=$line5
;;
6)
echo 'number is 6, please fix your [spring.application.name] current!'
read line6
applicationName=$line6
;;
7)
echo 'number is 7, please fix your [liquibase.enabled] current!'
read line7
liquibaseEnabled=$line7
;;
8)
echo 'number is 8, please fix your [servlet.multipart.max-file-size] current!'
read line8
multipartMaxFileSize=$line8
;;
9)
echo 'number is 9, please fix your [spring.banner.location] current!'
read line9
bannerLocation=$line9
;;
10)
echo 'number is 10, please fix your [management.endpoints.web.exposure.include] current!'
read line10
webExposureInclude=$line10
;;
11)
echo 'number is 11, please fix your [management.endpoint.health.show-details] current!'
read line11
healthShowDeails=$line11
;;
12)
echo 'number is 12, please fix your [management.endpoint.health.roles] current!'
read line12
healthRoles=$line12
;;
13)
echo 'number is 13, please fix your [the MySQL server host ip] current!'
read line13
MySQLHostIp=$line13
;;
14)
echo 'number is 14, please fix your [the MySQL server host port] current!'
read line14
MySQLHostPort=$line14
;;
15)
echo 'number is 15, please fix your [the MySQL database name] current!'
read line15
datasourceName=$line15
;;
16)
echo 'number is 16, please fix your [the MySQL database character encoding name] current!'
read line16
characterEncoding=$line16
;;
17)
echo 'number is 17, please fix your [spring.datasource.username] current!'
read line17
datasourceUsername=$line17
;;
18)
echo 'number is 18, please fix your [spring.datasource.password] current!'
read line18
datasourcePassword=$line18
;;
19)
echo 'number is 19, please fix your [server-config.process.name] current!'
read line19
processName=$line19
;;
20)
echo 'number is 20, please fix your [the server-config.process.description] current!'
read line20
processDescription=$line20
;;
21)
echo 'number is 21, please fix your [the server-config.process.server-address] current!'
read line21
processServerAddress=$line21
;;
22)
echo 'number is 22, please fix your [the server-config.process.port] current!'
read line22
processPort=$line22
;;
23)
echo 'number is 23, please fix your [the server-config.process.context-root] current!'
read line23
processContextRoot=$line23
;;
24)
echo 'number is 24, please fix your [the server-config.process.rest-root] current!'
read line24
processRestRoot=$line24
;;
25)
echo 'number is 25, please fix your [the server-config.process.user-name] current!'
read line25
processUserName=$line25
;;
26)
echo 'number is 26, please fix your [the server-config.process.password] current!'
read line26
processPassword=$line26
;;
27)
echo 'number is 27, please fix your [the server-config.cmmn.name] current!'
read line27
cmmnName=$line27
;;
28)
echo 'number is 28, please fix your [the server-config.cmmn.description] current!'
read line28
cmmnDescription=$line28
;;
29)
echo 'number is 29, please fix your [the server-config.cmmn.server-address] current!'
read line29
cmmnServerAddress=$line29
;;
30)
echo 'number is 30, please fix your [the server-config.cmmn.port] current!'
read line30
cmmnPort=$line30
;;
31)
echo 'number is 31, please fix your [the server-config.cmmn.context-root] current!'
read line31
cmmnContextRoot=$line31
;;
32)
echo 'number is 32, please fix your [the server-config.cmmn.rest-root] current!'
read line32
cmmnRestRoot=$line32
;;
33)
echo 'number is 33, please fix your [the server-config.cmmn.user-name] current!'
read line33
cmmnUserName=$line33
;;
34)
echo 'number is 34, please fix your [the server-config.cmmn.password] current!'
read line34
cmmnPassword=$line34
;;
35)
echo 'number is 35, please fix your [server-config.dmn.name] current!'
read line35
dmnName=$line35
;;
36)
echo 'number is 36, please fix your [server-config.dmn.description] current!'
read line36
dmnDescription=$line36
;;
37)
echo 'number is 37, please fix your [server-config.dmn.server-address] current!'
read line37
dmnServerAddress=$line37
;;
38)
echo 'number is 38, please fix your [server-config.dmn.port] current!'
read line38
dmnPort=$line38
;;
39)
echo 'number is 39, please fix your [server-config.dmn.context-root] current!'
read line39
dmnContextRoot=$line39
;;
40)
echo 'number is 40, please fix your [server-config.dmn.rest-root] current!'
read line40
dmnRestRoot=$line40
;;
41)
echo 'number is 41, please fix your [server-config.dmn.user-name] current!'
read line41
dmnUserName=$line41
;;
42)
echo 'number is 42, please fix your [server-config.dmn.password] current!'
read line42
dmnPassword=$line42
;;
43)
echo 'number is 43, please fix your [server-config.form.name] current!'
read line43
formName=$line43
;;
44)
echo 'number is 44, please fix your [server-config.form.description] current!'
read line44
formDescription=$line44
;;
45)
echo 'number is 45, please fix your [server-config.form.server-address] current!'
read line45
formServerAddress=$line45
;;
46)
echo 'number is 46, please fix your [server-config.form.port] current!'
read line46
formPort=$line46
;;
47)
echo 'number is 47, please fix your [server-config.form.context-root] current!'
read line47
formContextRoot=$line47
;;
48)
echo 'number is 48, please fix your [server-config.form.rest-root] current!'
read line48
formRestRoot=$line48
;;
49)
echo 'number is 49, please fix your [server-config.form.user-name] current!'
read line49
formUserName=$line49
;;
50)
echo 'number is 50, please fix your [server-config.form.password] current!'
read line50
formPassword=$line50
;;
51)
echo 'number is 51, please fix your [server-config.content.name] current!'
read line51
contentName=$line51
;;
52)
echo 'number is 52, please fix your [server-config.content.description] current!'
read line52
contentDescription=$line52
;;
53)
echo 'number is 53, please fix your [server-config.content.server-address] current!'
read line53
contentServerAddress=$line53
;;
54)
echo 'number is 54, please fix your [server-config.content.port] current!'
read line54
contentPort=$line54
;;
55)
echo 'number is 55, please fix your [server-config.content.context-root] current!'
read line55
contentContextRoot=$line55
;;
56)
echo 'number is 56, please fix your [server-config.content.rest-root] current!'
read line56
contentRestRoot=$line56
;;
57)
echo 'number is 57, please fix your [server-config.content.user-name] current!'
read line57
contentUserName=$line57
;;
58)
echo 'number is 58, please fix your [server-config.content.password] current!'
read line58
contentPassword=$line58
;;
59)
echo 'number is 59, please fix your [flowable.common.app.idm-url.ip] current!'
read line59
appIdmUrlIp=$line59
;;
60)
echo 'number is 60, please fix your [flowable.common.app.idm-url.port] current!'
read line60
appIdmUrlPort=$line60
;;
61)
echo 'number is 61, please fix your [flowable.common.app.idm-admin.user] current!'
read line61
appIdmAdminUser=$line61
;;
62)
echo 'number is 62, please fix your [flowable.common.app.idm-admin.password] current!'
read line62
appIdmAdminPassoword=$line62
;;
*)
echo 'Error'
;;
esac
echo -n "confirm,if wrong, please choice 'n' to fix it !, input y/n:"
read flag
done

echo "flowable-admin.application.properties input info submit successfully!!"

cat >application.properties <<EOF
server.port=$port
server.servlet.context-path=$contextPath
management.endpoints.jmx.unique-names=$jmxUniqueNames
# This is needed to force use of JDK proxies instead of using CGLIB
spring.aop.proxy-target-class=$proxyTargetClass
spring.aop.auto=$auto
spring.application.name=$applicationName
spring.liquibase.enabled=$liquibaseEnabled
spring.servlet.multipart.max-file-size=$multipartMaxFileSize
spring.banner.location=$bannerLocation
# The default domain for generating ObjectNames must be specified. Otherwise when multiple Spring Boot applications start in the same servlet container
# all would be created with the same name (com.zaxxer.hikari:name=dataSource,type=HikariDataSource) for example
spring.jmx.default-domain=$applicationName
# Expose all actuator endpoints to the web
# They are exposed, but only authenticated users can see /info and /health abd users with access-admin can see the others
management.endpoints.web.exposure.include=$webExposureInclude
# Full health details should only be displayed when a user is authorized
management.endpoint.health.show-details=when_authorized
# Only users with role access-admin can access full health details
management.endpoint.health.roles=access-admin
# Spring prefixes the roles with ROLE_. However, Flowable does not have that concept yet, so we need to override that with an empty string
flowable.common.app.role-prefix=

# MySQL example (default)

#spring.datasource.driver-class-name=org.h2.Driver
#spring.datasource.url=jdbc:h2:tcp://localhost/flowableadmin
#spring.datasource.url=jdbc:h2:~/flowable-db/db;AUTO_SERVER=TRUE;AUTO_SERVER_PORT=9091;DB_CLOSE_DELAY=-1

spring.datasource.driver-class-name=com.mysql.jdbc.Driver
spring.datasource.url=jdbc:mysql://$MySQLHostIp:$MySQLHostPort/$datasourceName?characterEncoding=$characterEncoding

#spring.datasource.driver-class-name=org.postgresql.Driver
#spring.datasource.url=jdbc:postgresql://localhost:5432/flowableadmin

#spring.datasource.driver-class-name=com.microsoft.sqlserver.jdbc.SQLServerDriver
#spring.datasource.url=jdbc:sqlserver://localhost:1433;databaseName=flowableadmin

#spring.datasource.driver-class-name=oracle.jdbc.driver.OracleDriver
#spring.datasource.url=jdbc:oracle:thin:@localhost:1521:FLOWABLEADMIN

#spring.datasource.driver-class-name=com.ibm.db2.jcc.DB2Driver
#spring.datasource.url=jdbc:db2://localhost:50000/flowableadmin

spring.datasource.username=$datasourceUsername
spring.datasource.password=$datasourcePassword

# JNDI CONFIG

# If uncommented, the datasource will be looked up using the configured JNDI name.
# This will have preference over any datasource configuration done below that doesn't use JNDI
#
# Eg for JBoss: java:jboss/datasources/flowableDS
#
#spring.datasource.jndi-name==jdbc/flowableDS

# Set whether the lookup occurs in a J2EE container, i.e. if the prefix "java:comp/env/" needs to be added if the JNDI
# name doesn't already contain it. Default is "true".
#datasource.jndi.resourceRef=true

#
# Connection pool (see https://github.com/brettwooldridge/HikariCP#configuration-knobs-baby)
#

#spring.datasource.hikari.minimum-idle=5
#spring.datasource.hikari.maximum-pool-size=100
# test query for H2, MySQL, PostgreSQL and Microsoft SQL Server
#spring.datasource.hikari.connection-test-query=select 1
# test query for Oracle
#spring.datasource.hikari.connection-test-query=SELECT 1 FROM DUAL
# test query for DB2
#spring.datasource.hikari.connection-test-query=SELECT current date FROM sysibm.sysdummy1
#spring.datasource.hikari.idle-timeout=1800

# Default REST endpoint configs
#
# Process engine

flowable.admin.app.server-config.process.name=$processName
flowable.admin.app.server-config.process.description=$processDescription
flowable.admin.app.server-config.process.server-address=$processServerAddress
flowable.admin.app.server-config.process.port=$processPort
flowable.admin.app.server-config.process.context-root=$processContextRoot
flowable.admin.app.server-config.process.rest-root=$processRestRoot
flowable.admin.app.server-config.process.user-name=$processUserName
flowable.admin.app.server-config.process.password=$processPassword

# CMMN engine
flowable.admin.app.server-config.cmmn.name=$cmmnName
flowable.admin.app.server-config.cmmn.description=$cmmnDescription
flowable.admin.app.server-config.cmmn.server-address=$cmmnServerAddress
flowable.admin.app.server-config.cmmn.port=$cmmnPort
flowable.admin.app.server-config.cmmn.context-root=$cmmnContextRoot
flowable.admin.app.server-config.cmmn.rest-root=$cmmnRestRoot
flowable.admin.app.server-config.cmmn.user-name=$cmmnUserName
flowable.admin.app.server-config.cmmn.password=$cmmnPassword

# DMN engine
flowable.admin.app.server-config.dmn.name=$dmnName
flowable.admin.app.server-config.dmn.description=$dmnDescription
flowable.admin.app.server-config.dmn.server-address=$dmnServerAddress
flowable.admin.app.server-config.dmn.port=$dmnPort
flowable.admin.app.server-config.dmn.context-root=$dmnContextRoot
flowable.admin.app.server-config.dmn.rest-root=$dmnRestRoot
flowable.admin.app.server-config.dmn.user-name=$dmnUserName
flowable.admin.app.server-config.dmn.password=$dmnPassword

# Form engine
flowable.admin.app.server-config.form.name=$formName
flowable.admin.app.server-config.form.description=$formDescription
flowable.admin.app.server-config.form.server-address=$formServerAddress
flowable.admin.app.server-config.form.port=$formPort
flowable.admin.app.server-config.form.context-root=$formContextRoot
flowable.admin.app.server-config.form.rest-root=$formRestRoot
flowable.admin.app.server-config.form.user-name=$formUserName
flowable.admin.app.server-config.form.password=$formPassword

# Content engine
flowable.admin.app.server-config.content.name=$contentName
flowable.admin.app.server-config.content.description=$contentDescription
flowable.admin.app.server-config.content.server-address=$contentServerAddress
flowable.admin.app.server-config.content.port=$contentPort
flowable.admin.app.server-config.content.context-root=$contentContextRoot
flowable.admin.app.server-config.content.rest-root=$contentRestRoot
flowable.admin.app.server-config.content.user-name=$contentUserName
flowable.admin.app.server-config.content.password=$contentPassword

# Passwords for rest endpoints and master configs are stored encrypted in the database using AES/CBC/PKCS5PADDING
# It needs a 128-bit initialization vector (http://en.wikipedia.org/wiki/Initialization_vector)
# and a 128-bit secret key represented as 16 ascii characters below
#
# Do note that if these properties are changed after passwords have been saved, all existing passwords
# will not be able to be decrypted and the password would need to be reset in the UI.
flowable.admin.app.security.encryption.credentials-i-v-spec=j8kdO2hejA9lKmm6
flowable.admin.app.security.encryption.credentials-secret-spec=9FGl73ngxcOoJvmL
spring.security.filter.dispatcher-types=REQUEST,FORWARD,ASYNC

flowable.common.app.idm-url=http://$appIdmUrlIp:$appIdmUrlPort/flowable-idm

flowable.common.app.idm-admin.user=$appIdmAdminUser
flowable.common.app.idm-admin.password=$appIdmAdminPassoword

EOF

# back to ../wars/flowable-admin/
cd ..
cd ..

rm -rf flowable-admin.war
jar -cvfM0 flowable-admin.war ./

echo "flowable-admin.war is successfull!"

#----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------#
#----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------#
#----------------------------------------------------------------------------------------flowable-idm------------------------------------------------------------------------------------------------------#
#----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------#
#----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------#
# NOW is flowable-idm.war processesing...

# back to ../wars/
cd ..

cd flowable-idm/WEB-INF/classes

rm -rf application.properties
touch application.properties
echo "This is flowable-idm's application.properties"
echo -n "[1]please input the server.port = ? (default is 8080)"
read port
if [[ $port == "" ]]; then
port='8080'
fi

echo -n "your server.port is $port"

echo -n "[2]please input the context-path = ? (default is /flowable-idm)"
read contextPath
if [[ $contextPath == "" ]]; then
contextPath='/flowable-idm'
fi

echo -n "[3]please input the jmx.unique-names = ? (default is true)"
read jmxUniqueNames
if [[ $jmxUniqueNames == "" ]]; then
jmxUniqueNames='true'
fi

echo -n "[4]please input the proxy-target-class = ? (default is true)"
read proxyTargetClass
if [[ $proxyTargetClass ]]; then
proxyTargetClass='true'
fi

echo -n "[5]please input the spring.aop.auto = ? (default is true)"
read auto
if [[ $auto == "" ]]; then
auto='true'
fi

echo -n "[6]please input the spring.application.name = ? (default is flowable-ui-idm)"
read applicationName
if [[ $applicationName == "" ]]; then
applicationName='flowable-ui-idm'
fi

echo -n "[7]please input the MySQL server host ip = ? (default is 127.0.0.1)"
read MySQLHostIp
if [[ $MySQLHostIp == "" ]]; then
MySQLHostIp='127.0.0.1'
fi

echo -n "[8]please input the MySQL server host port = ? (default is 3306)"
read MySQLHostPort
if [[ $MySQLHostPort == "" ]]; then
MySQLHostPort='3306'
fi

echo -n "[9]please input the MySQL database name = ? (default is flowable)"
read datasourceName
if [[ $datasourceName == "" ]]; then
datasourceName='flowable'
fi

echo -n "[10]please input the MySQL database character encoding name = ? (default is UTF-8)"
read characterEncoding
if [[ $characterEncoding == "" ]]; then
characterEncoding='UTF-8'
fi

echo -n "[11]please input the spring.datasource.username = ? (default is root)"
read datasourceUsername
if [[ $datasourceUsername == "" ]]; then
datasourceUsername='root'
fi

echo -n "[12]please input the spring.datasource.password = ? (default is 123456)"
read datasourcePassword
if [[ $datasourcePassword == "" ]]; then
datasourcePassword='123456'
fi

echo -n "confirm,if wrong, please choice 'n' to fix it !, input y/n:"

read flag
while [[ $flag == "n" ]]; do
echo 'input number 1 to 12'
echo 'your number is'
read aNum
case $aNum in
1)
echo 'number is 1, please fix your [port] current!'
read line1
port=$line1
;;
2)
echo 'number is 2, please fix your [context-path] current!'
read line2
contextPath=$line2
;;
3)
echo 'number is 3, please fix your [jmx.unique-names] current!'
read line3
jmxUniqueNames=$line3
;;
4)
echo 'number is 4, please fix your [proxy-target-class] current!'
read line4
proxyTargetClass=$line4
;;
5)
echo 'number is 5, please fix your [pring.aop.auto] current!'
read line5
auto=$line5
;;
6)
echo 'number is 6, please fix your [spring.application.name] current!'
read line6
applicationName=$line6
;;
7)
echo 'number is 7, please fix your [MySQL server host ip] current!'
read line7
MySQLHostIp=$line7
;;
8)
echo 'number is 8, please fix your [MySQL server host port] current!'
read line8
MySQLHostPort=$line8
;;
9)
echo 'number is 9, please fix your [MySQL database name] current!'
read line9
datasourceName=$line9
;;
10)
echo 'number is 10, please fix your [MySQL database character encoding name] current!'
read line10
characterEncoding=$line10
;;
11)
echo 'number is 11, please fix your [spring.datasource.username] current!'
read line11
datasourceUsername=$line11
;;
12)
echo 'number is 12, please fix your [spring.datasource.password] current!'
read line12
datasourcePassword=$line12
;;
*)
echo 'Error'
;;
esac
echo -n "confirm,if wrong, please choice 'n' to fix it !, input y/n:"
read flag
done

echo "flowable-idm.application.properties input info submit successfully!!"

cat >application.properties <<EOF
server.port=$port
server.servlet.context-path=$contextPath
management.endpoints.jmx.unique-names=$jmxUniqueNames
# This is needed to force use of JDK proxies instead of using CGLIB
spring.aop.proxy-target-class=$proxyTargetClass
spring.aop.auto=$auto
# The default domain for generating ObjectNames must be specified. Otherwise when multiple Spring Boot applications start in the same servlet container
# all would be created with the same name (com.zaxxer.hikari:name=dataSource,type=HikariDataSource) for example
spring.application.name=$applicationName

# Expose all actuator endpoints to the web
# They are exposed, but only authenticated users can see /info and /health abd users with access-admin can see the others
management.endpoints.web.exposure.include=*
# Full health details should only be displayed when a user is authorized
management.endpoint.health.show-details=when_authorized
# Only users with role access-admin can access full health details
management.endpoint.health.roles=access-admin
# Spring prefixes the roles with ROLE_. However, Flowable does not have that concept yet, so we need to override that with an empty string
flowable.common.app.role-prefix=
#
# SECURITY
#
flowable.idm.app.security.remember-me-key=testkey

#flowable.idm.password-encoder=spring_bcrypt
spring.security.filter.dispatcher-types=REQUEST,FORWARD,ASYNC

#
# DATABASE
#

#spring.datasource.driver-class-name=org.h2.Driver
#spring.datasource.url=jdbc:h2:~/flowable-db/db;AUTO_SERVER=TRUE;AUTO_SERVER_PORT=9091;DB_CLOSE_DELAY=-1

spring.datasource.driver-class-name=com.mysql.jdbc.Driver
spring.datasource.url=jdbc:mysql://$MySQLHostIp:$MySQLHostPort/$datasourceName?characterEncoding=$characterEncoding

#spring.datasource.driver-class-name=org.postgresql.Driver
#spring.datasource.url=jdbc:postgresql://localhost:5432/flowableidm

#spring.datasource.driver-class-name=com.microsoft.sqlserver.jdbc.SQLServerDriver
#spring.datasource.url=jdbc:sqlserver://localhost:1433;databaseName=flowableidm

#spring.datasource.driver-class-name=oracle.jdbc.driver.OracleDriver
#spring.datasource.url=jdbc:oracle:thin:@localhost:1521:FLOWABLEIDM

#spring.datasource.driver-class-name=com.ibm.db2.jcc.DB2Driver
#spring.datasource.url=jdbc:db2://localhost:50000/flowableidm

spring.datasource.username=$datasourceUsername
spring.datasource.password=$datasourcePassword

#spring.datasource.hikari.minimum-idle=5
#spring.datasource.hikari.maximum-pool-size=100
# test query for H2, MySQL, PostgreSQL and Microsoft SQL Server
#spring.datasource.hikari.connection-test-query=select 1
# test query for Oracle
#spring.datasource.hikari.connection-test-query=SELECT 1 FROM DUAL
# test query for DB2
#spring.datasource.hikari.connection-test-query=SELECT current date FROM sysibm.sysdummy1
#spring.datasource.hikari.idle-timeout=1800

#
# LDAP
#
#flowable.idm.ldap.enabled=true
#flowable.idm.ldap.server=ldap://localhost
#flowable.idm.ldap.port=10389
#flowable.idm.ldap.user=uid=admin, ou=system
#flowable.idm.ldap.password=secret
#flowable.idm.ldap.base-dn=o=flowable
#flowable.idm.ldap.query.user-by-id=(&(objectClass=inetOrgPerson)(uid={0}))
#flowable.idm.ldap.query.user-by-full-name-like=(&(objectClass=inetOrgPerson)(|({0}=*{1}*)({2}=*{3}*)))
#flowable.idm.ldap.query.all-users=(objectClass=inetOrgPerson)
#flowable.idm.ldap.query.groups-for-user=(&(objectClass=groupOfUniqueNames)(uniqueMember={0}))
#flowable.idm.ldap.query.all-groups=(objectClass=groupOfUniqueNames)
#flowable.idm.ldap.attribute.user-id=uid
#flowable.idm.ldap.attribute.first-name=cn
#flowable.idm.ldap.attribute.last-name=sn
#flowable.idm.ldap.attribute.email=mail
#flowable.idm.ldap.attribute.group-id=cn
#flowable.idm.ldap.attribute.group-name=cn
#flowable.idm.ldap.cache.group-size=10000
#flowable.idm.ldap.cache.group-expiration=180000

#
# DEFAULT ADMINISTRATOR ACCOUNT
#
flowable.idm.app.admin.user-id=admin
flowable.idm.app.admin.password=test
flowable.idm.app.admin.first-name=Test
flowable.idm.app.admin.last-name=Administrator
flowable.idm.app.admin.email=admin@flowable.org

# Rest api in IDM app

flowable.idm.app.rest-enabled=true

# Configures the way user credentials are verified when doing a REST API call:
# 'any-user' : the user needs to exist and the password need to match. Any user is allowed to do the call (this is the pre 6.3.0 behavior)
# 'verify-privilege' : the user needs to exist, the password needs to match and the user needs to have the 'rest-api' privilege
# If nothing set, defaults to 'verify-privilege'
flowable.rest.app.authentication-mode=verify-privilege

EOF

# back to ../wars/flowable-idm/
cd ..
cd ..

rm -rf flowable-idm.war
jar -cvfM0 flowable-idm.war ./

echo "flowable-idm.war is successfull!"

#----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------#
#----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------#
#----------------------------------------------------------------------------------------flowable-modeler--------------------------------------------------------------------------------------------------#
#----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------#
#----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------#
# NOW is flowable-idm.war processesing...

# back to ../wars/
cd ..
cd flowable-modeler/WEB-INF/classes
#!/usr/bin/env bash

rm -rf application.properties
touch application.properties

echo -n "[1]please input the server.port = ? (default is 8888)"
read port
if [[ $port == "" ]]; then
port='8888'
fi

echo -n "[2]please input the context-path = ? (default is /flowable-modeler)"
read contextPath
if [[ $contextPath == "" ]]; then
contextPath='/flowable-modeler'
fi

echo -n "[3]please input the jmx.unique-names = ? (default is true)"
read jmxUniqueNames
if [[ $jmxUniqueNames == "" ]]; then
jmxUniqueNames='true'
fi

echo -n "[4]please input the proxy-target-class = ? (default is true)"
read proxyTargetClass
if [[ $proxyTargetClass ]]; then
proxyTargetClass='true'
fi

echo -n "[5]please input the spring.aop.auto = ? (default is false)"
read auto
if [[ $auto == "" ]]; then
auto='false'
fi

echo -n "[6]please input the spring.application.name = ? (default is flowable-ui-modeler)"
read applicationName
if [[ $applicationName == "" ]]; then
applicationName='flowable-ui-modeler'
fi

echo -n "[7]please input the MySQL server host ip = ? (default is 127.0.0.1)"
read MySQLHostIp
if [[ $MySQLHostIp == "" ]]; then
MySQLHostIp='127.0.0.1'
fi

echo -n "[8]please input the MySQL server host port = ? (default is 3306)"
read MySQLHostPort
if [[ $MySQLHostPort == "" ]]; then
MySQLHostPort='3306'
fi

echo -n "[9]please input the MySQL database name = ? (default is flowable)"
read datasourceName
if [[ $datasourceName == "" ]]; then
datasourceName='flowable'
fi

echo -n "[10]please input the MySQL database character encoding name = ? (default is UTF-8)"
read characterEncoding
if [[ $characterEncoding == "" ]]; then
characterEncoding='UTF-8'
fi

echo -n "[11]please input the spring.datasource.username = ? (default is root)"
read datasourceUsername
if [[ $datasourceUsername == "" ]]; then
datasourceUsername='root'
fi

echo -n "[12]please input the spring.datasource.password = ? (default is 123456)"
read datasourcePassword
if [[ $datasourcePassword == "" ]]; then
datasourcePassword='123456'
fi

echo -n "[13]please input the flowable.common.app.idm-url.host = ? (default is http://localhost)"
read mappIdmUrlHost
if [[ $mappIdmUrlHost == "" ]]; then
mappIdmUrlHost='http://localhost'
fi

echo -n "[14]please input the flowable.common.app.idm-url.port = ? (default is 8080)"
read mappIdmUrlPort
if [[ $mappIdmUrlPort == "" ]]; then
mappIdmUrlPort='8080'
fi

echo -n "[15]please input the flowable.common.app.idm-admin.user = ? (default is admin)"
read mappIdmAdminUser
if [[ $mappIdmAdminUser == "" ]]; then
mappIdmAdminUser='admin'
fi

echo -n "[16]please input the flowable.common.app.idm-admin.password = ? (default is test)"
read mappIdmAdminPassword
if [[ $mappIdmAdminPassword == "" ]]; then
mappIdmAdminPassword='test'
fi

echo -n "[17]please input the flowable.modeler.app.deployment-api-url = ? (default is http://localhost)"
read modelerAppDeploymentApiUrlHost
if [[ $modelerAppDeploymentApiUrlHost == "" ]]; then
modelerAppDeploymentApiUrlHost='http://localhost'
fi

echo -n "[18]please input the flowable.modeler.app.deployment-api-url.port = ? (default is 8080)"
read modelerAppDeploymentApiUrlPort
if [[ $modelerAppDeploymentApiUrlPort == "" ]]; then
modelerAppDeploymentApiUrlPort='8080'
fi

echo -n "confirm,if wrong, please choice 'n' to fix it !, input y/n:"

read flag
while [[ $flag == "n" ]]; do
echo 'input number 1 to 18'
echo 'your number is'
read aNum
case $aNum in
1)
echo 'number is 1, please fix your [port] current!'
read line1
port=$line1
;;
2)
echo 'number is 2, please fix your [context-path] current!'
read line2
contextPath=$line2
;;
3)
echo 'number is 3, please fix your [jmx.unique-names] current!'
read line3
jmxUniqueNames=$line3
;;
4)
echo 'number is 4, please fix your [proxy-target-class] current!'
read line4
proxyTargetClass=$line4
;;
5)
echo 'number is 5, please fix your [pring.aop.auto] current!'
read line5
auto=$line5
;;
6)
echo 'number is 6, please fix your [spring.application.name] current!'
read line6
applicationName=$line6
;;
7)
echo 'number is 7, please fix your [MySQL server host ip] current!'
read line7
MySQLHostIp=$line7
;;
8)
echo 'number is 8, please fix your [MySQL server host port] current!'
read line8
MySQLHostPort=$line8
;;
9)
echo 'number is 9, please fix your [MySQL database name] current!'
read line9
datasourceName=$line9
;;
10)
echo 'number is 10, please fix your [MySQL database character encoding name] current!'
read line10
characterEncoding=$line10
;;
11)
echo 'number is 11, please fix your [spring.datasource.username] current!'
read line11
datasourceUsername=$line11
;;
12)
echo 'number is 12, please fix your [spring.datasource.password] current!'
read line12
datasourcePassword=$line12
;;
13)
echo 'number is 13, please fix your [flowable.common.app.idm-url.host] current!'
read line13
mappIdmUrlHost=$line13
;;
14)
echo 'number is 14, please fix your [flowable.common.app.idm-url.port] current!'
read line14
mappIdmUrlPort=$line14
;;
15)
echo 'number is 15, please fix your [flowable.common.app.idm-admin.user] current!'
read line15
mappIdmAdminUser=$line15
;;
16)
echo 'number is 16, please fix your [flowable.common.app.idm-admin.password] current!'
read line16
mappIdmAdminPassword=$line16
;;
17)
echo 'number is 17, please fix your [flowable.modeler.app.deployment-api-url.host] current!'
read line17
modelerAppDeploymentApiUrlHost=$line17
;;
18)
echo 'number is 18, please fix your [flowable.modeler.app.deployment-api-url.port] current!'
read line18
modelerAppDeploymentApiUrlPort=$line18
;;
*)
echo 'Error'
;;
esac
echo -n "confirm,if wrong, please choice 'n' to fix it !, input y/n:"
read flag
done

echo "flowable-modeler.application.properties input info submit successfully!!"

cat >application.properties <<EOF
server.port=$port
server.servlet.context-path=$contextPath
management.endpoints.jmx.unique-names=$jmxUniqueNames
# This is needed to force use of JDK proxies instead of using CGLIB
spring.aop.proxy-target-class=$proxyTargetClass
spring.aop.auto=$auto
spring.application.name=$applicationName
#
# SECURITY
#
spring.security.filter.dispatcher-types=REQUEST,FORWARD,ASYNC
spring.liquibase.enabled=false
spring.banner.location=classpath:/org/flowable/spring/boot/flowable-banner.txt
# The default domain for generating ObjectNames must be specified. Otherwise when multiple Spring Boot applications start in the same servlet container
# all would be created with the same name (com.zaxxer.hikari:name=dataSource,type=HikariDataSource) for example
spring.jmx.default-domain=$applicationName

# Expose all actuator endpoints to the web
# They are exposed, but only authenticated users can see /info and /health abd users with access-admin can see the others
management.endpoints.web.exposure.include=*
# Full health details should only be displayed when a user is authorized
management.endpoint.health.show-details=when_authorized
# Only users with role access-admin can access full health details
management.endpoint.health.roles=access-admin
# Spring prefixes the roles with ROLE_. However, Flowable does not have that concept yet, so we need to override that with an empty string
flowable.common.app.role-prefix=

#
# DATABASE
#

#spring.datasource.driver-class-name=org.h2.Driver
#spring.datasource.url=jdbc:h2:~/flowable-db/db;AUTO_SERVER=TRUE;AUTO_SERVER_PORT=9091;DB_CLOSE_DELAY=-1

spring.datasource.driver-class-name=com.mysql.jdbc.Driver
spring.datasource.url=jdbc:mysql://$MySQLHostIp:$MySQLHostPort/$datasourceName?characterEncoding=$characterEncoding

#spring.datasource.driver-class-name=org.postgresql.Driver
#spring.datasource.url=jdbc:postgresql://localhost:5432/flowablemodeler

#spring.datasource.driver-class-name=com.microsoft.sqlserver.jdbc.SQLServerDriver
#spring.datasource.url=jdbc:sqlserver://localhost:1433;databaseName=flowablemodeler

#spring.datasource.driver-class-name=oracle.jdbc.driver.OracleDriver
#spring.datasource.url=jdbc:oracle:thin:@localhost:1521:FLOWABLEMODELER

#spring.datasource.driver-class-name=com.ibm.db2.jcc.DB2Driver
#spring.datasource.url=jdbc:db2://localhost:50000/flowablemodeler

spring.datasource.username=$datasourceUsername
spring.datasource.password=$datasourcePassword

#spring.datasource.hikari.minimum-idle=5
#spring.datasource.hikari.maximum-pool-size=100
# test query for H2, MySQL, PostgreSQL and Microsoft SQL Server
#spring.datasource.hikari.connection-test-query=select 1
# test query for Oracle
#spring.datasource.hikari.connection-test-query=SELECT 1 FROM DUAL
# test query for DB2
#spring.datasource.hikari.connection-test-query=SELECT current date FROM sysibm.sysdummy1
#spring.datasource.hikari.idle-timeout=1800

# The maximum file upload limit. Set to -1 to set to 'no limit'. Expressed in bytes
spring.servlet.multipart.max-file-size=10MB

flowable.common.app.idm-url=$mappIdmUrlHost:$mappIdmUrlPort/flowable-idm
flowable.common.app.idm-admin.user=$mappIdmAdminUser
flowable.common.app.idm-admin.password=$mappIdmAdminPassword

flowable.modeler.app.deployment-api-url=$modelerAppDeploymentApiUrlHost:$modelerAppDeploymentApiUrlPort/flowable-task/process-api


# Rest API

flowable.modeler.app.rest-enabled=true

# Configures the way user credentials are verified when doing a REST API call:
# 'any-user' : the user needs to exist and the password need to match. Any user is allowed to do the call (this is the pre 6.3.0 behavior)
# 'verify-privilege' : the user needs to exist, the password needs to match and the user needs to have the 'rest-api' privilege
# If nothing set, defaults to 'verify-privilege'
flowable.rest.app.authentication-mode=verify-privilege


# Set the tenant_id
# For the modeler this determines under which tenant_id to store and publish models
# When not provided, empty or only contains whitespace it defaults to the user's tenant id if available
# otherwise it uses no tenant id
#flowable.common.app.tenant-id=demo

EOF

# back to ../wars/flowable-modeler/
cd ..
cd ..

rm -rf flowable-modeler.war
jar -cvfM0 flowable-modeler.war ./

echo "flowable-modeler.war is successfull!"

# back to ../wars/
cd ..

#----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------#
#----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------#
#----------------------------------------------------------------------------------------flowable-rest--------------------------------------------------------------------------------------------------#
#----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------#
#----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------#
# NOW is flowable-rest.war processesing...

cd flowable-rest/WEB-INF/classes

rm -rf application.properties
touch application.properties

echo -n "[1]please input the MySQL server host ip = ? (default is 127.0.0.1)"
read MySQLHostIp
if [[ $MySQLHostIp == "" ]]; then
MySQLHostIp='127.0.0.1'
fi

echo -n "[2]please input the MySQL server host port = ? (default is 3306)"
read MySQLHostPort
if [[ $MySQLHostPort == "" ]]; then
MySQLHostPort='3306'
fi

echo -n "[3]please input the MySQL database name = ? (default is flowable)"
read datasourceName
if [[ $datasourceName == "" ]]; then
datasourceName='flowable'
fi

echo -n "[4]please input the MySQL database character encoding name = ? (default is UTF-8)"
read characterEncoding
if [[ $characterEncoding == "" ]]; then
characterEncoding='UTF-8'
fi

echo -n "[5]please input the spring.datasource.username = ? (default is root)"
read datasourceUsername
if [[ $datasourceUsername == "" ]]; then
datasourceUsername='root'
fi

echo -n "[6]please input the spring.datasource.password = ? (default is 123456)"
read datasourcePassword
if [[ $datasourcePassword == "" ]]; then
datasourcePassword='123456'
fi

echo -n "confirm,if wrong, please choice 'n' to fix it !, input y/n:"

read flag
while [[ $flag == "n" ]]; do
echo 'input number 1 to 6'
echo 'your number is'
read aNum
case $aNum in
1)
echo 'number is 1, please fix your [MySQL server host ip] current!'
read line1
MySQLHostIp=$line1
;;
2)
echo 'number is 2, please fix your [MySQL server host port] current!'
read line2
MySQLHostPort=$line2
;;
3)
echo 'number is 3, please fix your [MySQL database name] current!'
read line3
datasourceName=$line3
;;
4)
echo 'number is 4, please fix your [MySQL database character encoding name] current!'
read line4
characterEncoding=$line4
;;
5)
echo 'number is 5, please fix your [spring.datasource.username] current!'
read line5
datasourceUsername=$line5
;;
6)
echo 'number is 6, please fix your [spring.datasource.password] current!'
read line6
datasourcePassword=$line6
;;
*)
echo 'Error'
;;
esac
echo -n "confirm,if wrong, please choice 'n' to fix it !, input y/n:"
read flag
done

echo "flowable-modeler.application.properties input info submit successfully!!"

cat >application.properties <<EOF
#server.port=8086
server.servlet.context-path=/flowable-rest
# Expose all actuator endpoints to the web
# They are exposed, but only authenticated users can see /info and /health abd users with access-admin can see the others
management.endpoints.web.exposure.include=*
# Full health details should only be displayed when a user is authorized
management.endpoint.health.show-details=when_authorized
# Only users with role access-admin can access full health details
management.endpoint.health.roles=access-admin
# Spring prefixes the roles with ROLE_. However, Flowable does not have that concept yet, so we need to override that with an empty string
flowable.rest.app.role-prefix=
spring.application.name=flowable-rest
spring.banner.location=classpath:/org/flowable/spring/boot/flowable-banner.txt
# The default domain for generating ObjectNames must be specified. Otherwise when multiple Spring Boot applications start in the same servlet container
# all would be created with the same name (com.zaxxer.hikari:name=dataSource,type=HikariDataSource) for example
spring.jmx.default-domain=/flowable-rest
# datasource
spring.datasource.driver-class-name=com.mysql.jdbc.Driver
spring.datasource.url=jdbc:mysql://$MySQLHostIp:$MySQLHostPort/$datasourceName?characterEncoding=$characterEncoding
spring.datasource.username=$datasourceUsername
spring.datasource.password=$datasourcePassword

#spring.datasource.hikari.minimum-idle=5
#spring.datasource.hikari.maximum-pool-size=100
# test query for H2, MySQL, PostgreSQL and Microsoft SQL Server
#spring.datasource.hikari.connection-test-query=select 1
# test query for Oracle
#spring.datasource.hikari.connection-test-query=SELECT 1 FROM DUAL
# test query for DB2
#spring.datasource.hikari.connection-test-query=SELECT current date FROM sysibm.sysdummy1
#spring.datasource.hikari.idle-timeout=1800

spring.datasource.type=com.zaxxer.hikari.HikariDataSource

# Deploys demo process definitions that allows to have some example data when using the REST API's
flowable.rest.app.create-demo-definitions=true

# engine properties
flowable.process.servlet.path=/service
flowable.database-schema-update=true
flowable.async-executor-activate=true
flowable.history-level=full

# rest properties

# Configures the way user credentials are verified when doing a REST API call:
# 'any-user' : the user needs to exist and the password need to match. Any user is allowed to do the call (this is the pre 6.3.0 behavior)
# 'verify-privilege' : the user needs to exist, the password needs to match and the user needs to have the 'rest-api' privilege
# If nothing set, defaults to 'verify-privilege'
flowable.rest.app.authentication-mode=verify-privilege

# Enable/disable Java serializable objects to be passed as variables in the REST API.
rest.variables.allow.serializable=true

# Enable/disable whether the docs are available on /docs
flowable.rest.app.swagger-docs-enabled=true

flowable.rest.app.admin.user-id=rest-admin
flowable.rest.app.admin.password=test
flowable.rest.app.admin.firstname=Rest
flowable.rest.app.admin.lastname=Admin
EOF

# back to ../wars/flowable-rest/
cd ..
cd ..

rm -rf flowable-rest.war
jar -cvfM0 flowable-rest.war ./

echo "flowable-rest.war is successfull!"

# back to ../wars
cd ..

#----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------#
#----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------#
#----------------------------------------------------------------------------------------flowable-task--------------------------------------------------------------------------------------------------#
#----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------#
#----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------#
# NOW is flowable-task.war processesing...

cd flowable-task/WEB-INF/classes

rm -rf application.properties
touch application.properties

echo -n "[1]please input the MySQL server host ip = ? (default is 127.0.0.1)"
read MySQLHostIp
if [[ $MySQLHostIp == "" ]]; then
MySQLHostIp='127.0.0.1'
fi

echo -n "[2]please input the MySQL server host port = ? (default is 3306)"
read MySQLHostPort
if [[ $MySQLHostPort == "" ]]; then
MySQLHostPort='3306'
fi

echo -n "[3]please input the MySQL database name = ? (default is flowable)"
read datasourceName
if [[ $datasourceName == "" ]]; then
datasourceName='flowable'
fi

echo -n "[4]please input the MySQL database character encoding name = ? (default is UTF-8)"
read characterEncoding
if [[ $characterEncoding == "" ]]; then
characterEncoding='UTF-8'
fi

echo -n "[5]please input the spring.datasource.username = ? (default is root)"
read datasourceUsername
if [[ $datasourceUsername == "" ]]; then
datasourceUsername='root'
fi

echo -n "[6]please input the spring.datasource.password = ? (default is 123456)"
read datasourcePassword
if [[ $datasourcePassword == "" ]]; then
datasourcePassword='123456'
fi

echo -n "[7]please input the flowable.common.app.idm-url.host = ? (default is http://localhost)"
read mappIdmUrlHost
if [[ $mappIdmUrlHost == "" ]]; then
mappIdmUrlHost='http://localhost'
fi

echo -n "[8]please input the flowable.common.app.idm-url.port = ? (default is 8080)"
read mappIdmUrlPort
if [[ $mappIdmUrlPort == "" ]]; then
mappIdmUrlPort='8080'
fi

echo -n "[9]please input the flowable.common.app.idm-admin.user = ? (default is admin)"
read mappIdmAdminUser
if [[ $mappIdmAdminUser == "" ]]; then
mappIdmAdminUser='admin'
fi

echo -n "[10]please input the flowable.common.app.idm-admin.password = ? (default is test)"
read mappIdmAdminPassword
if [[ $mappIdmAdminPassword == "" ]]; then
mappIdmAdminPassword='test'
fi

echo -n "confirm,if wrong, please choice 'n' to fix it !, input y/n:"

read flag
while [[ $flag == "n" ]]; do
echo 'input number 1 to 10'
echo 'your number is'
read aNum
case $aNum in
1)
echo 'number is 1, please fix your [MySQL server host ip] current!'
read line1
MySQLHostIp=$line1
;;
2)
echo 'number is 2, please fix your [MySQL server host port] current!'
read line2
MySQLHostPort=$line2
;;
3)
echo 'number is 3, please fix your [MySQL database name] current!'
read line3
datasourceName=$line3
;;
4)
echo 'number is 4, please fix your [MySQL database character encoding name] current!'
read line4
characterEncoding=$line4
;;
5)
echo 'number is 5, please fix your [spring.datasource.username] current!'
read line5
datasourceUsername=$line5
;;
6)
echo 'number is 6, please fix your [spring.datasource.password] current!'
read line6
datasourcePassword=$line6
;;
7)
echo 'number is 7, please fix your [flowable.common.app.idm-url.host] current!'
read line7
mappIdmUrlHost=$line7
;;
8)
echo 'number is 8, please fix your [flowable.common.app.idm-url.port] current!'
read line8
mappIdmUrlPort=$line8
;;
9)
echo 'number is 9, please fix your [flowable.common.app.idm-admin.user] current!'
read line9
mappIdmAdminUser=$line9
;;
10)
echo 'number is 10, please fix your [flowable.common.app.idm-admin.password] current!'
read line10
mappIdmAdminPassword=$line10
;;
*)
echo 'Error'
;;
esac
echo -n "confirm,if wrong, please choice 'n' to fix it !, input y/n:"
read flag
done

echo "flowable-modeler.application.properties input info submit successfully!!"

cat >application.properties <<EOF
server.port=9999
server.servlet.context-path=/flowable-task
management.endpoints.jmx.unique-names=true
# This is needed to force use of JDK proxies instead of using CGLIB
spring.aop.proxy-target-class=false
spring.aop.auto=false
spring.application.name=flowable-ui-task
spring.banner.location=classpath:/org/flowable/spring/boot/flowable-banner.txt
# The default domain for generating ObjectNames must be specified. Otherwise when multiple Spring Boot applications start in the same servlet container
# all would be created with the same name (com.zaxxer.hikari:name=dataSource,type=HikariDataSource) for example
spring.jmx.default-domain=/flowable-task
#
# SECURITY
#
spring.security.filter.dispatcher-types=REQUEST,FORWARD,ASYNC

# Expose all actuator endpoints to the web
# They are exposed, but only authenticated users can see /info and /health abd users with access-admin can see the others
management.endpoints.web.exposure.include=*
# Full health details should only be displayed when a user is authorized
management.endpoint.health.show-details=when_authorized
# Only users with role access-admin can access full health details
management.endpoint.health.roles=access-admin
# Spring prefixes the roles with ROLE_. However, Flowable does not have that concept yet, so we need to override that with an empty string
flowable.common.app.role-prefix=

#
# DATABASE
#

#spring.datasource.driver-class-name=org.h2.Driver
#spring.datasource.url=jdbc:h2:~/flowable-db/db;AUTO_SERVER=TRUE;AUTO_SERVER_PORT=9091;DB_CLOSE_DELAY=-1

spring.datasource.driver-class-name=com.mysql.jdbc.Driver
spring.datasource.url=jdbc:mysql://$MySQLHostIp:$MySQLHostPort/$datasourceName?characterEncoding=$characterEncoding

#spring.datasource.driver-class-name=org.postgresql.Driver
#spring.datasource.url=jdbc:postgresql://localhost:5432/flowable

#spring.datasource.driver-class-name=com.microsoft.sqlserver.jdbc.SQLServerDriver
#spring.datasource.url=jdbc:sqlserver://localhost:1433;databaseName=flowablea

#spring.datasource.driver-class-name=oracle.jdbc.driver.OracleDriver
#spring.datasource.url=jdbc:oracle:thin:@localhost:1521:FLOWABLE

#spring.datasource.driver-class-name=com.ibm.db2.jcc.DB2Driver
#spring.datasource.url=jdbc:db2://localhost:50000/flowable

spring.datasource.username=$datasourceUsername
spring.datasource.password=$datasourcePassword

# JNDI CONFIG

# If uncommented, the datasource will be looked up using the configured JNDI name.
# This will have preference over any datasource configuration done below that doesn't use JNDI
#
# Eg for JBoss: java:jboss/datasources/flowableDS
#
#spring.datasource.jndi-name==jdbc/flowableDS

# Set whether the lookup occurs in a J2EE container, i.e. if the prefix "java:comp/env/" needs to be added if the JNDI
# name doesn't already contain it. Default is "true".
#datasource.jndi.resourceRef=true

#
# Connection pool (see https://github.com/brettwooldridge/HikariCP#configuration-knobs-baby)
#

#spring.datasource.hikari.minimum-idle=5
#spring.datasource.hikari.maximum-pool-size=100
# test query for H2, MySQL, PostgreSQL and Microsoft SQL Server
#spring.datasource.hikari.connection-test-query=select 1
# test query for Oracle
#spring.datasource.hikari.connection-test-query=SELECT 1 FROM DUAL
# test query for DB2
#spring.datasource.hikari.connection-test-query=SELECT current date FROM sysibm.sysdummy1
#spring.datasource.hikari.idle-timeout=1800

#
# EMAIL
#

#flowable.mail.server.host=localhost
#flowable.mail.server.port=1025
#flowable.mail.server.username=
#flowable.mail.server.password=

#
# FLOWABLE
#

flowable.process.definition-cache-limit=512
#flowable.dmn.strict-mode=false
flowable.process.async.executor.default-async-job-acquire-wait-time-in-millis=5000
flowable.process.async.executor.default-timer-job-acquire-wait-time-in-millis=5000

flowable.cmmn.async.executor.default-async-job-acquire-wait-time-in-millis=5000
flowable.cmmn.async.executor.default-timer-job-acquire-wait-time-in-millis=5000

# The maximum file upload limit. Set to -1 to set to 'no limit'. Expressed in bytes
spring.servlet.multipart.max-file-size=10MB

# For development purposes, data folder is created inside the sources ./data folder
flowable.content.storage.root-folder=data/
flowable.content.storage.create-root=true

flowable.common.app.idm-url=$mappIdmUrlHost:$mappIdmUrlPort/flowable-idm
flowable.common.app.idm-admin.user=$mappIdmAdminUser
flowable.common.app.idm-admin.password=$mappIdmAdminPassword

#flowable.common.app.redirect-on-auth-success=http://localhost:8080/flowable-task
#flowable.modeler.app.deployment-api-url=http://localhost:8080/flowable-task/process-api

flowable.experimental.debugger.enabled=false

# Rest API in task application

# If false, disables the rest api in the task app
flowable.task.app.rest-enabled=true

# Configures the way user credentials are verified when doing a REST API call:
# 'any-user' : the user needs to exist and the password need to match. Any user is allowed to do the call (this is the pre 6.3.0 behavior)
# 'verify-privilege' : the user needs to exist, the password needs to match and the user needs to have the 'rest-api' privilege
# If nothing set, defaults to 'verify-privilege'
flowable.rest.app.authentication-mode=verify-privilege
EOF

# back to ../wars/flowable-task/
cd ..
cd ..

rm -rf flowable-task.war
jar -cvfM0 flowable-task.war ./

echo "flowable-task.war is successfull!"