make status values configurable
This commit is contained in:
@@ -4,17 +4,12 @@ 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,
|
||||
@@ -144,10 +139,11 @@ func FrontendConfigFromStruct(cfg *config.Config) map[string]interface{} {
|
||||
"installed": true,
|
||||
"maintenance": false,
|
||||
"needsDbUpgrade": false,
|
||||
"version": version.String + ".0",
|
||||
"versionstring": version.String,
|
||||
"version": version.Long(),
|
||||
"versionstring": version.GetString(),
|
||||
"edition": "Community",
|
||||
"productname": "oCIS",
|
||||
"productname": "Infinite Scale",
|
||||
"product": "oCIS",
|
||||
"hostname": "",
|
||||
},
|
||||
"support_url_signing": true,
|
||||
@@ -218,9 +214,9 @@ func FrontendConfigFromStruct(cfg *config.Config) map[string]interface{} {
|
||||
"version": map[string]interface{}{
|
||||
"product": "oCIS",
|
||||
"edition": "Community",
|
||||
"major": parsedVersion.Major(),
|
||||
"minor": parsedVersion.Minor(),
|
||||
"micro": parsedVersion.Patch(),
|
||||
"major": version.Parsed().Major(),
|
||||
"minor": version.Parsed().Minor(),
|
||||
"micro": version.Parsed().Patch(),
|
||||
"string": version.String,
|
||||
},
|
||||
},
|
||||
|
||||
@@ -55,6 +55,11 @@ func Server(cfg *config.Config) *cli.Command {
|
||||
ocdav.Prefix(cfg.HTTP.Prefix),
|
||||
ocdav.GatewaySvc(cfg.Reva.Address),
|
||||
ocdav.JWTSecret(cfg.TokenManager.JWTSecret),
|
||||
ocdav.ProductName(cfg.Status.ProductName),
|
||||
ocdav.Product(cfg.Status.Product),
|
||||
ocdav.Version(cfg.Status.Version),
|
||||
ocdav.VersionString(cfg.Status.VersionString),
|
||||
ocdav.Edition(cfg.Status.Edition),
|
||||
// ocdav.FavoriteManager() // FIXME needs a proper persistence implementation
|
||||
// ocdav.LockSystem(), // will default to the CS3 lock system
|
||||
// ocdav.TLSConfig() // tls config for the http server
|
||||
|
||||
@@ -33,6 +33,7 @@ type Config struct {
|
||||
Middleware Middleware `yaml:"middleware"`
|
||||
|
||||
Context context.Context `yaml:"-"`
|
||||
Status Status `yaml:"-"`
|
||||
}
|
||||
type Tracing struct {
|
||||
Enabled bool `yaml:"enabled" env:"OCIS_TRACING_ENABLED;OCDAV_TRACING_ENABLED" desc:"Activates tracing."`
|
||||
@@ -75,3 +76,12 @@ type Middleware struct {
|
||||
type Auth struct {
|
||||
CredentialsByUserAgent map[string]string `yaml:"credentials_by_user_agent"`
|
||||
}
|
||||
|
||||
// Status holds the configurable values for the status.php
|
||||
type Status struct {
|
||||
Version string
|
||||
VersionString string
|
||||
Product string
|
||||
ProductName string
|
||||
Edition string
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ package defaults
|
||||
|
||||
import (
|
||||
"github.com/owncloud/ocis/v2/extensions/ocdav/pkg/config"
|
||||
"github.com/owncloud/ocis/v2/ocis-pkg/version"
|
||||
)
|
||||
|
||||
func FullDefaultConfig() *config.Config {
|
||||
@@ -42,6 +43,13 @@ func DefaultConfig() *config.Config {
|
||||
CredentialsByUserAgent: map[string]string{},
|
||||
},
|
||||
},
|
||||
Status: config.Status{
|
||||
Version: version.Long(),
|
||||
VersionString: version.GetString(),
|
||||
Product: "oCIS",
|
||||
ProductName: "Infinite Scale",
|
||||
Edition: "Community",
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user