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

Support rest config #1

Draft
wants to merge 16 commits into
base: master
Choose a base branch
from

Conversation

pragmatrix
Copy link

@JayceFayne Hi, I am in the process of adding support for the Syncthing REST configuration part, and would like to hear your opinion about if this PR is the right way to extend the Client API based on what you've intended.

The code below is yet untested with an actual Syncthing service but the test cases should cover most details and should be something we can build on.

I plan to use the client as a tool to apply / re-apply our specific Syncthing configuration across multiple production servers (and yes, we considered to just modify the underlying XML configuration files, but this felt rather crude, so I decided to see how far we get utilizing the REST API). Long term plan is to create a client that applies the desired state principle.

Details:

  • Most fields were Option<> initially, but decided against it for simplicity and to see if we can get around that. This requires clients to pull default configurations when they want to create folders, makes PATCH based on the serialization types impossible, and also puts some constraints on the minimum version of the Syncthing REST API we can use (and perhaps even breaks future updates depending on how the Syncthing team keeps backward compatibility).
  • Added two new request functions to Client: send and delete and changed request a little to remove repetitive code. This is not yet completely fleshed out and might change.
  • Added rstest to assist in creating test cases.
  • Created types for what I was able too.

The next step is to actually use the Client to apply a concrete configuration and see how that turns out.

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

Successfully merging this pull request may close these issues.

1 participant