From b7b9d87f8a750d367a6202cfaf7446017a23ef92 Mon Sep 17 00:00:00 2001 From: Zac Spitzer Date: Mon, 24 Jun 2024 19:38:28 +0200 Subject: [PATCH] Update compareDefault.cfm --- custom/default-cfconfig/compareDefault.cfm | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/custom/default-cfconfig/compareDefault.cfm b/custom/default-cfconfig/compareDefault.cfm index 1fad340..e916498 100644 --- a/custom/default-cfconfig/compareDefault.cfm +++ b/custom/default-cfconfig/compareDefault.cfm @@ -1,18 +1,29 @@ default = deserializeJSON( fileRead( expandPath( "./.CFConfig-default.json" ) ) ); empty = deserializeJSON( fileRead( expandPath('{lucee-config}.CFConfig.json') ) ); - + + ignore = [ "salt", "hspw" ]; + problems = 0; + for ( cfg in default.keyList() ){ - if (!structKeyExists( empty, cfg ) ){ + if ( arrayContains( ignore, cfg ) ) { + //ignore + } else if (!structKeyExists( empty, cfg ) ){ systemOutput("", true ); systemOutput("#cfg# missing in empty .CFConfig.json", true ); + problems++; } else { - if ( empty[cfg].toJson() neq default[cfg].toJson() ){ + if ( empty[ cfg ].toJson() neq default[ cfg ].toJson() ){ systemOutput("", true ); systemOutput("#cfg# is different!", true ); - systemOutput("#chr(9)# empty : #empty[cfg].toJson()# ", true ); - systemOutput("#chr(9)# default: #default[cfg].toJson()# ", true ); + systemOutput("#chr(9)# empty : #empty[ cfg ].toJson()# ", true ); + systemOutput("#chr(9)# default: #default[ cfg ].toJson()# ", true ); + problems++; } } } + + if ( problems > 0 ){ + throw "#problems# config elements were different!"; + } \ No newline at end of file