archaius
archaius copied to clipboard
Add support for json based files which contains configurations.
I am looking for a feature within the netflix archius which would enable to load json based configuration file instantly once the changes have been made to the same.
@agarwalsanchit1 how would you handle json object arrays?
{"people": [
{"firstName": "Anthony", "lastName": "Clink"},
{"firstName": "Tony", "lastName": "Blink"}
]}
would you want people[0].firstName
would you want people[1].lastName?
How would you represent this?
Remember that json is an object graph not a flat key value store.
@AnthonyClink It's achievable. In the case, I would consider each attribute of the index location as a single attribute.
I would share the implementation within a week.
Have you considered using the typesafe/lightbend module and underlying library? It should support reading configuration from JSON more or less out of the box.
@gorzell Thanks for suggesting it. I worked on your approach and it did not suit our requirements.
Our project is based on the JSON-based configuration management system. We require a functionality to reload all the configurations if any changes have been made. There are lots of configurations files and all of them are onto S3 to support externalization.
I am not sure if you are using a 1.x or 2.x version of Archaius. But I would also encourage you to keep the parsing and loading logic separate.
A 1.x example of loading configuration from S3 can be found in: https://github.com/Netflix/archaius/blob/master/archaius-jclouds/src/main/java/com/netflix/config/sources/BlobStoreConfigurationSource.java and the related interface is https://github.com/Netflix/archaius/blob/master/archaius-core/src/main/java/com/netflix/config/PolledConfigurationSource.java.
I believe https://github.com/Netflix/archaius/blob/2.x/archaius2-core/src/main/java/com/netflix/archaius/readers/URLConfigReader.java is the relevant example in 2.x.
@gorzell We are using 2.0 version of Archaius. All the configuration files are placed inside the jar file and some of them are placed individually onto S3 and within the project itself.
Following are the features to be implemented within the Netflix Archaius to support our project requirements:-
- To read JSON and properties based configuration files from JAR file.
- To read individual JSON config file from S3 and within the project.
I will share the code within a week for reviewing purpose. Is it Okay :)
I will fork 2.0 version of the Archaius branch and will commit the added code over there.