Skip to content

Commit 8cd9d6d

Browse files
UI: Allow to set default discovery timeout via configuration (#211)
* allow to set default discovery timeout via configuration --------- Co-authored-by: Patrik Matiaško <patrik.matiasko@gmail.com>
1 parent 2386cbb commit 8cd9d6d

29 files changed

+1292
-177
lines changed

.github/workflows/staticAnalysis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ jobs:
1919
- uses: actions/checkout@v4
2020
- uses: actions/setup-go@v5
2121
with:
22-
go-version: "^1.20" # The Go version to download (if necessary) and use.
22+
go-version: "1.21" # The Go version to download (if necessary) and use.
2323
check-latest: true
2424
- run: go version
2525

config.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ apis:
4444
allowCredentials: false
4545
ui:
4646
enabled: false
47+
defaultDiscoveryTimeout: 2s
4748
directory: ""
4849
grpc:
4950
enabled: true

pb/clear_cache.pb.go

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pb/create_resource.pb.go

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pb/delete_resource.pb.go

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pb/disown_device.pb.go

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pb/get_configuration.go

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,14 +71,24 @@ func (c *BuildInfo) Clone() *BuildInfo {
7171
}
7272
}
7373

74-
func NewGetConfigurationResponse(info *BuildInfo) *GetConfigurationResponse {
74+
func NewGetConfigurationResponse(info *BuildInfo, ui *UIConfiguration) *GetConfigurationResponse {
7575
return &GetConfigurationResponse{
7676
BuildInfo: info,
7777
Version: info.GetVersion(),
7878
BuildDate: info.GetBuildDate(),
7979
CommitHash: info.GetCommitHash(),
8080
CommitDate: info.GetCommitDate(),
8181
ReleaseUrl: info.GetReleaseUrl(),
82+
Ui: ui,
83+
}
84+
}
85+
86+
func (r *UIConfiguration) Clone() *UIConfiguration {
87+
if r == nil {
88+
return nil
89+
}
90+
return &UIConfiguration{
91+
DefaultDiscoveryTimeout: r.GetDefaultDiscoveryTimeout(),
8292
}
8393
}
8494

@@ -94,6 +104,7 @@ func (r *GetConfigurationResponse) Clone() *GetConfigurationResponse {
94104
ReleaseUrl: r.GetBuildInfo().GetReleaseUrl(),
95105
RemoteProvisioning: r.RemoteProvisioning.Clone(),
96106
BuildInfo: r.GetBuildInfo().Clone(),
107+
Ui: r.GetUi().Clone(),
97108
}
98109
}
99110

pb/get_configuration.pb.go

Lines changed: 137 additions & 59 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pb/get_configuration.proto

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,13 @@ message BuildInfo {
7474
string release_url = 5;
7575
}
7676

77+
// UI configuration
78+
message UIConfiguration {
79+
// similar to https://github.com/plgd-dev/hub/blob/4c4861a4bc483ba4080a1d448063da392eff4026/grpc-gateway/pb/hubConfiguration.proto#L61
80+
81+
int64 default_discovery_timeout = 100; // default discovery timeout in nanoseconds
82+
}
83+
7784
message GetConfigurationResponse {
7885
enum DeviceAuthenticationMode {
7986
PRE_SHARED_KEY = 0;
@@ -91,4 +98,5 @@ message GetConfigurationResponse {
9198
RemoteProvisioning remote_provisioning = 8;
9299
string owner = 9;
93100
BuildInfo build_info = 10;
101+
UIConfiguration ui = 11;
94102
}

pb/get_device.pb.go

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)