Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for json based files which contains configurations. #563

Open
agarwalsanchit1 opened this issue Nov 5, 2018 · 7 comments
Open

Comments

@agarwalsanchit1
Copy link

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.

@AnthonyClink
Copy link

@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.

@agarwalsanchit1
Copy link
Author

@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.

@gorzell
Copy link
Contributor

gorzell commented Nov 7, 2018

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.

@agarwalsanchit1
Copy link
Author

agarwalsanchit1 commented Nov 9, 2018

@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.

@gorzell
Copy link
Contributor

gorzell commented Nov 9, 2018

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.

@agarwalsanchit1
Copy link
Author

agarwalsanchit1 commented Nov 12, 2018

@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:-

  1. To read JSON and properties based configuration files from JAR file.
  2. 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 :)

@agarwalsanchit1
Copy link
Author

I will fork 2.0 version of the Archaius branch and will commit the added code over there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants