Skip to content

Commit

Permalink
Update reva and use ocis-pkg version string in capabilities
Browse files Browse the repository at this point in the history
Needed to use github.com/Masterminds/semver/v3 instead of v1 to be able
to extract major, minor and patch version from a version string.
Falling back to 0.0.0 in any error case (e.g. if the version.String is a
hash)
  • Loading branch information
kulmann authored and micbar committed May 6, 2022
1 parent baf8c8e commit ad7936b
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 10 deletions.
5 changes: 5 additions & 0 deletions changelog/unreleased/ocs-version-product-field.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Enhancement: Product field in OCS version

We've added a new field to the OCS Version, which is supposed to announce the product name. The web ui as a client will make use of it to make the backend product and version available (e.g. for easier bug reports).

https://github.com/owncloud/ocis/pull/2918
25 changes: 16 additions & 9 deletions extensions/frontend/pkg/revaconfig/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,17 @@ import (
"path"
"strconv"

"github.com/Masterminds/semver"
"github.com/owncloud/ocis/v2/extensions/frontend/pkg/config"
"github.com/owncloud/ocis/v2/ocis-pkg/version"
)

// FrontendConfigFromStruct will adapt an oCIS config struct into a reva mapstructure to start a reva service.
func FrontendConfigFromStruct(cfg *config.Config) map[string]interface{} {
parsedVersion, err := semver.NewVersion(version.String)
if err != nil {
parsedVersion, _ = semver.NewVersion("0.0.0")
}
archivers := []map[string]interface{}{
{
"enabled": true,
Expand Down Expand Up @@ -138,10 +144,10 @@ func FrontendConfigFromStruct(cfg *config.Config) map[string]interface{} {
"installed": true,
"maintenance": false,
"needsDbUpgrade": false,
"version": "10.0.11.5",
"versionstring": "10.0.11",
"edition": "community",
"productname": "reva",
"version": version.String + ".0",
"versionstring": version.String,
"edition": "Community",
"productname": "oCIS",
"hostname": "",
},
"support_url_signing": true,
Expand Down Expand Up @@ -210,11 +216,12 @@ func FrontendConfigFromStruct(cfg *config.Config) map[string]interface{} {
},
},
"version": map[string]interface{}{
"edition": "reva",
"major": 10,
"minor": 0,
"micro": 11,
"string": "10.0.11",
"product": "oCIS",
"edition": "Community",
"major": parsedVersion.Major(),
"minor": parsedVersion.Minor(),
"micro": parsedVersion.Patch(),
"string": version.String,
},
},
},
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ go 1.17
require (
github.com/CiscoM31/godata v1.0.5
github.com/GeertJohan/yubigo v0.0.0-20190917122436-175bc097e60e
github.com/Masterminds/semver v1.5.0
github.com/ReneKroon/ttlcache/v2 v2.11.0
github.com/blevesearch/bleve/v2 v2.3.2
github.com/blevesearch/bleve_index_api v1.0.1
Expand Down Expand Up @@ -89,7 +90,6 @@ require (
github.com/Azure/go-ntlmssp v0.0.0-20211209120228-48547f28849e // indirect
github.com/BurntSushi/toml v1.1.0 // indirect
github.com/Masterminds/goutils v1.1.1 // indirect
github.com/Masterminds/semver v1.5.0 // indirect
github.com/Masterminds/sprig v2.22.0+incompatible // indirect
github.com/Microsoft/go-winio v0.5.1 // indirect
github.com/ProtonMail/go-crypto v0.0.0-20211112122917-428f8eabeeb3 // indirect
Expand Down

0 comments on commit ad7936b

Please sign in to comment.