Hi everyone! I've got a Spring Boot config file I'm parsing. Values don't really matter:
spring.application.name: some application
I'm trying to extract / group different parts of that file, and I'm looking for what the suggested / idiomatic way of doing this is. I'm trying to follow the "data > functions > macros" idiom and the "better 100 functions for one data structure".
Specifically, I'm looking to parse / group the web endpoints, and then the database properties, in order to validate them using some business logic.
I've already parsed the file using
java.util.Properties, so that's not of interest here. The file above is converted to a map.
Create a separate function for each "grouping" I want that parses what I want and returns a new map with just the data I want.
defn get-endpoints [props] returns
defn get-database-properties [props] etc.
Add additional keys to the original map to group what I want.
defn parse-groupings [props] returns
"spring.application.name" "some application",
;; the rest of the original properties
;; web endpoints go here
;; database properties get embedded here
There's a lot more solutions, of course, but I'm wondering what the community recommends.