-
-
Notifications
You must be signed in to change notification settings - Fork 402
Add gRPC interface function to write settings to file #1144
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about a demo in the client_example?
diff --git a/client_example/main.go b/client_example/main.go
index 4a6164b7..08cf1c43 100644
--- a/client_example/main.go
+++ b/client_example/main.go
@@ -90,6 +90,10 @@ func main() {
log.Println("calling GetValue(foo)")
callGetValue(settingsClient)
+ // Write settings to file.
+ log.Println("calling Write()")
+ callWrite(settingsClient)
+
// Before we can do anything with the CLI, an "instance" must be created.
// We keep a reference to the created instance because we will need it to
// run subsequent commands.
@@ -256,6 +260,17 @@ func callGetAll(client settings.SettingsClient) {
log.Printf("Settings: %s", getAllResp.GetJsonData())
}
+func callWrite(client settings.SettingsClient) {
+ _, err := client.Write(context.Background(),
+ &settings.WriteRequest{
+ FilePath: path.Join(dataDir, "written-settings.yml"),
+ })
+
+ if err != nil {
+ log.Fatalf("Error writing settings: %s", err)
+ }
+}
+
func initInstance(client rpc.ArduinoCoreClient) *rpc.Instance {
// The configuration for this example client only contains the path to
// the data folder.
Yeah, that's a good idea. Sooner than later I want to ditch that Soon. 😢 |
I'm all for adding integration tests, but the purpose of |
Ideally well written tests can act as documentation but I get your concerns. |
Please check if the PR fulfills these requirements
before creating one)
UPGRADING.md
has been updated with a migration guide (for breaking changes)Adds a new function to the gRPC interface.
There is currently no way to update the config file from the gRPC interface.
Consumers of the gRPC interface can now call a function
Write(*rpc.WriteRequest)
to write settings currently stored in memory to the file specified inrpc.WriteRequest
.Nope.
None.
See how to contribute