@@ -3033,12 +3033,13 @@ private static void updateCwsUiProperties() throws IOException {
30333033 content = content .replace ("__CWS_DB_PORT__" , cws_db_port );
30343034 content = content .replace ("__CWS_DB_USERNAME__" , cws_db_username );
30353035 content = content .replace ("__CWS_DB_PASSWORD__" , cws_db_password );
3036- content = content .replace ("__CWS_CONSOLE_SSL_PORT__" , cws_console_ssl_port );
3037- content = content .replace ("__CWS_ES_PROTOCOL__" , elasticsearch_protocol );
3038- content = content .replace ("__CWS_ES_HOST__" , elasticsearch_host );
3039- content = content .replace ("__CWS_ES_INDEX_PREFIX__" , elasticsearch_index_prefix );
3040- content = content .replace ("__CWS_ES_PORT__" , elasticsearch_port );
3041- content = content .replace ("__CWS_ES_USE_AUTH__" , elasticsearch_use_auth );
3036+ content = content .replace ("__CWS_CONSOLE_SSL_PORT__" , cws_console_ssl_port );
3037+ // Use default values if Elasticsearch was not configured
3038+ content = content .replace ("__CWS_ES_PROTOCOL__" , elasticsearch_protocol != null ? elasticsearch_protocol : "http" );
3039+ content = content .replace ("__CWS_ES_HOST__" , elasticsearch_host != null ? elasticsearch_host : "localhost" );
3040+ content = content .replace ("__CWS_ES_INDEX_PREFIX__" , elasticsearch_index_prefix != null ? elasticsearch_index_prefix : "cws" );
3041+ content = content .replace ("__CWS_ES_PORT__" , elasticsearch_port != null ? elasticsearch_port : "9200" );
3042+ content = content .replace ("__CWS_ES_USE_AUTH__" , elasticsearch_use_auth != null ? elasticsearch_use_auth : "N" );
30423043 content = content .replace ("__CWS_ENABLE_CLOUD_AUTOSCALING__" , cws_enable_cloud_autoscaling );
30433044 content = content .replace ("__CWS_CLOUDWATCH_ENDPOINT__" , aws_cloudwatch_endpoint );
30443045 content = content .replace ("__CWS_METRICS_PUBLISHING_INTERVAL__" , metrics_publishing_interval );
@@ -3077,13 +3078,17 @@ private static void updateCwsUiProperties() throws IOException {
30773078 content = content .replace ("__CWS_HISTORY_LEVEL__" , history_level );
30783079 content = content .replace ("__CWS_WORKER_MAX_NUM_RUNNING_PROCS__" , worker_max_num_running_procs );
30793080 content = content .replace ("__CWS_WORKER_ABANDONED_DAYS__" , worker_abandoned_days );
3080- content = content .replace ("__AWS_DEFAULT_REGION__" , aws_default_region );
3081-
3082- // ES auth might not be in use
3083- if (elasticsearch_use_auth .equalsIgnoreCase ("Y" )) {
3084- content = content .replace ("__CWS_ES_USERNAME__" , elasticsearch_username );
3085- content = content .replace ("__CWS_ES_PASSWORD__" , elasticsearch_password );
3086- }
3081+ content = content .replace ("__AWS_DEFAULT_REGION__" , aws_default_region );
3082+
3083+ // ES auth might not be in use - use defaults if not configured
3084+ if (elasticsearch_use_auth != null && elasticsearch_use_auth .equalsIgnoreCase ("Y" )) {
3085+ content = content .replace ("__CWS_ES_USERNAME__" , elasticsearch_username != null ? elasticsearch_username : "" );
3086+ content = content .replace ("__CWS_ES_PASSWORD__" , elasticsearch_password != null ? elasticsearch_password : "" );
3087+ } else {
3088+ // Provide empty defaults when auth is not configured
3089+ content = content .replace ("__CWS_ES_USERNAME__" , "" );
3090+ content = content .replace ("__CWS_ES_PASSWORD__" , "" );
3091+ }
30873092
30883093 // S3 Initiator might not be in use
30893094 if (aws_sqs_dispatcher_sqsUrl != null ) {
@@ -3154,7 +3159,9 @@ private static void updateCwsUiConfig() throws IOException {
31543159 Paths .get (cws_tomcat_webapps + SEP + "cws-ui" + SEP + "WEB-INF" + SEP + "applicationContext.xml" ));
31553160
31563161
3157- // Update clean_es_history.sh file
3162+ // Update clean_es_history.sh file
3163+ // Only update if Elasticsearch is configured (not skipped)
3164+ if (elasticsearch_protocol != null ) {
31583165 path = Paths .get (config_work_dir + SEP + "clean_es_history.sh" );
31593166 content = getFileContents (path );
31603167 content = content .replace ("__ES_PROTOCOL__" , elasticsearch_protocol );
@@ -3174,6 +3181,9 @@ private static void updateCwsUiConfig() throws IOException {
31743181 copy (
31753182 Paths .get (config_work_dir + SEP + "clean_es_history.sh" ),
31763183 Paths .get (cws_root + SEP + "clean_es_history.sh" ));
3184+ } else {
3185+ log .info ("Elasticsearch not configured - skipping clean_es_history.sh update" );
3186+ }
31773187
31783188
31793189 // UPDATE cws-ui brand name in FTL files
@@ -3378,20 +3388,27 @@ private static void deleteCwsUiWebApp() {
33783388 }
33793389
33803390
3381- private static void installLogstash () throws IOException {
3382- // UNZIP / INSTALL / SETUP LOGSTASH
3383- String logstashZipFilePath = cws_server_root + SEP + "logstash-" + logstash_ver + ".zip" ;
3384- String logstashDestDirectory = cws_server_root ;
3391+ private static void installLogstash () throws IOException {
3392+ // Skip logstash installation if Elasticsearch is not configured
3393+ if (elasticsearch_protocol == null || elasticsearch_host == null ) {
3394+ log .info ("Elasticsearch not configured - skipping Logstash installation" );
3395+ print (" Skipping Logstash installation (Elasticsearch not configured)" );
3396+ return ;
3397+ }
3398+
3399+ // UNZIP / INSTALL / SETUP LOGSTASH
3400+ String logstashZipFilePath = cws_server_root + SEP + "logstash-" + logstash_ver + ".zip" ;
3401+ String logstashDestDirectory = cws_server_root ;
33853402
3386- // Unzip the LogStash archive
3387- unzipFile (logstashZipFilePath , logstashDestDirectory );
3403+ // Unzip the LogStash archive
3404+ unzipFile (logstashZipFilePath , logstashDestDirectory );
33883405
3389- // Open up permissions of logstash executables
3390- openUpPermissions (logstashDestDirectory + SEP + "logstash-" + logstash_ver + SEP + "bin" + SEP + "logstash" );
3406+ // Open up permissions of logstash executables
3407+ openUpPermissions (logstashDestDirectory + SEP + "logstash-" + logstash_ver + SEP + "bin" + SEP + "logstash" );
33913408
3392- // CONFIGURE LOGSTASH CONF TO READ FROM CATALINA.OUT AND CWS.LOG
3393- // UPDATE cws-logstash.conf
3394- print (" Updating cws-logstash.conf..." );
3409+ // CONFIGURE LOGSTASH CONF TO READ FROM CATALINA.OUT AND CWS.LOG
3410+ // UPDATE cws-logstash.conf
3411+ print (" Updating cws-logstash.conf..." );
33953412 Path logstashFilePath = Paths .get (config_work_dir + SEP + "logging" + SEP + "cws-logstash.conf" );
33963413 String logstashContent = getFileContents (logstashFilePath );
33973414
0 commit comments