Skip to content

Commit

Permalink
Fix loading configuration from JSON in GS64
Browse files Browse the repository at this point in the history
  • Loading branch information
gcotelli committed Sep 20, 2023
1 parent a2df8d3 commit 75da14f
Showing 1 changed file with 13 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,13 @@ ConfigurationFromJsonSettingsFileProvider class >> loading: aJsonFileReference c
^ self new initializeLoading: aJsonFileReference chainedWith: aConfigurationProvider
]

{ #category : #private }
ConfigurationFromJsonSettingsFileProvider >> asJsonPath: aConfigurationParameter [

^ (aConfigurationParameter sectionsAsAttributeNames copyWith:
aConfigurationParameter attributeName) collect: #asSymbol
]

{ #category : #initialization }
ConfigurationFromJsonSettingsFileProvider >> initializeLoading: aFileReference chainedWith: aConfigurationProvider [

Expand All @@ -46,9 +53,11 @@ ConfigurationFromJsonSettingsFileProvider >> reloadConfiguration [
{ #category : #resolving }
ConfigurationFromJsonSettingsFileProvider >> valueFor: aConfigurationParameter ifFound: aPresentBlock ifNone: aFailBlock [

^ ( json atPath:
( aConfigurationParameter sectionsAsAttributeNames copyWith:
aConfigurationParameter attributeName ) ) ifNil: [
nextProvider valueFor: aConfigurationParameter ifFound: aPresentBlock ifNone: aFailBlock ]
^ (json atPath: (self asJsonPath: aConfigurationParameter))
ifNil: [
nextProvider
valueFor: aConfigurationParameter
ifFound: aPresentBlock
ifNone: aFailBlock ]
ifNotNil: aPresentBlock
]

0 comments on commit 75da14f

Please sign in to comment.