@@ -282,9 +282,9 @@ class FeatureToggles {
282282 /**
283283 * Populate this.__config.
284284 */
285- _processConfig ( { configRuntime, configFromFilesWithPath , configAuto } = { } ) {
285+ _processConfig ( { configRuntime, configFromFilesEntries , configAuto } = { } ) {
286286 const configRuntimeCount = this . _processConfigSource ( CONFIG_SOURCE . RUNTIME , configRuntime ) ;
287- const configFromFileCount = configFromFilesWithPath . reduce ( ( count , { configFilepath, configFromFile } ) => {
287+ const configFromFileCount = configFromFilesEntries . reduce ( ( count , [ configFilepath , configFromFile ] ) => {
288288 count += this . _processConfigSource ( CONFIG_SOURCE . FILE , configFromFile , configFilepath ) ;
289289 return count ;
290290 } , 0 ) ;
@@ -743,12 +743,12 @@ class FeatureToggles {
743743 }
744744
745745 static async _consolidatedConfigFilepaths ( configFilepath , configFilepaths ) {
746- const result = [ ] ;
746+ let result = [ ] ;
747747 if ( configFilepath ) {
748748 result . push ( configFilepath ) ;
749749 }
750750 if ( configFilepaths ) {
751- result . concat ( Object . values ( configFilepaths ) ) ;
751+ result = result . concat ( Object . values ( configFilepaths ) ) ;
752752 }
753753 if ( result . length === 0 && ( await tryPathReadable ( DEFAULT_CONFIG_FILEPATH ) ) ) {
754754 result . push ( DEFAULT_CONFIG_FILEPATH ) ;
@@ -775,10 +775,10 @@ class FeatureToggles {
775775 configFilepath ,
776776 configFilepaths
777777 ) ;
778- const configFromFilesWithPath = await Promise . all (
778+ const configFromFilesEntries = await Promise . all (
779779 consolidatedConfigFilepaths . map ( async ( configFilepath ) => {
780780 try {
781- return { configFilepath, configFromFile : await FeatureToggles . readConfigFromFile ( configFilepath ) } ;
781+ return [ configFilepath , await FeatureToggles . readConfigFromFile ( configFilepath ) ] ;
782782 } catch ( err ) {
783783 throw new VError (
784784 {
@@ -796,15 +796,19 @@ class FeatureToggles {
796796
797797 let toggleCounts ;
798798 try {
799- toggleCounts = this . _processConfig ( { configRuntime, configFromFilesWithPath, configAuto } ) ;
799+ toggleCounts = this . _processConfig ( {
800+ configRuntime,
801+ configFromFilesEntries,
802+ configAuto,
803+ } ) ;
800804 } catch ( err ) {
801805 throw new VError (
802806 {
803807 name : VERROR_CLUSTER_NAME ,
804808 cause : err ,
805809 info : {
806810 ...( configRuntime && { configRuntime : JSON . stringify ( configRuntime ) } ) ,
807- ...( configFromFilesWithPath && { configFromFilesMap : JSON . stringify ( configFromFilesWithPath ) } ) ,
811+ ...( configFromFilesEntries && { configFromFilesMap : JSON . stringify ( configFromFilesEntries ) } ) ,
808812 ...( configAuto && { configAuto : JSON . stringify ( configAuto ) } ) ,
809813 } ,
810814 } ,
0 commit comments