make the default settings bundles part of the config

This commit is contained in:
Michael Barz
2023-02-16 13:24:31 +01:00
parent 8fb9914757
commit 29501b2cfe
11 changed files with 125 additions and 104 deletions
+2 -1
View File
@@ -35,7 +35,8 @@ ci-node-generate:
include ../../.make/protobuf.mk
.PHONY: protobuf
protobuf: buf-generate
protobuf: buf-generate $(BINGO)
cd ../../protogen/gen/ && $(PROTOC_GO_INJECT_TAG) -input="ocis/messages/settings/v0/*.pb.go"
############ licenses ############
.PHONY: ci-node-check-licenses
+5 -3
View File
@@ -4,6 +4,7 @@ import (
"context"
"github.com/owncloud/ocis/v2/ocis-pkg/shared"
settingsmsg "github.com/owncloud/ocis/v2/protogen/gen/ocis/messages/settings/v0"
)
// Config combines all available configuration parts.
@@ -21,9 +22,10 @@ type Config struct {
GRPCClientTLS *shared.GRPCClientTLS `yaml:"grpc_client_tls"`
StoreType string `yaml:"store_type" env:"SETTINGS_STORE_TYPE" desc:"Store type configures the persistency driver. Supported values are \"metadata\" and \"filesystem\"."`
DataPath string `yaml:"data_path" env:"SETTINGS_DATA_PATH" desc:"The directory where the filesystem storage will store ocis settings. If not definied, the root directory derives from $OCIS_BASE_DATA_PATH:/settings."`
Metadata Metadata `yaml:"metadata_config"`
StoreType string `yaml:"store_type" env:"SETTINGS_STORE_TYPE" desc:"Store type configures the persistency driver. Supported values are \"metadata\" and \"filesystem\"."`
DataPath string `yaml:"data_path" env:"SETTINGS_DATA_PATH" desc:"The directory where the filesystem storage will store ocis settings. If not definied, the root directory derives from $OCIS_BASE_DATA_PATH:/settings."`
Metadata Metadata `yaml:"metadata_config"`
Bundles []*settingsmsg.Bundle `yaml:"bundles"`
AdminUserID string `yaml:"admin_user_id" env:"OCIS_ADMIN_USER_ID;SETTINGS_ADMIN_USER_ID" desc:"ID of the user that should receive admin privileges. Consider that the UUID can be encoded in some LDAP deployment configurations like in .ldif files. These need to be decoded beforehand."`
@@ -7,6 +7,7 @@ import (
"github.com/owncloud/ocis/v2/ocis-pkg/config/defaults"
"github.com/owncloud/ocis/v2/ocis-pkg/shared"
"github.com/owncloud/ocis/v2/services/settings/pkg/config"
rdefaults "github.com/owncloud/ocis/v2/services/settings/pkg/store/defaults"
)
func FullDefaultConfig() *config.Config {
@@ -51,6 +52,7 @@ func DefaultConfig() *config.Config {
StorageAddress: "127.0.0.1:9215",
SystemUserIDP: "internal",
},
Bundles: rdefaults.GenerateBundlesDefaultRoles(),
}
}
@@ -112,7 +112,7 @@ func (s *Store) initMetadataClient(mdc MetadataClient) error {
}
}
for _, p := range defaults.GenerateBundlesDefaultRoles() {
for _, p := range s.cfg.Bundles {
b, err := json.Marshal(p)
if err != nil {
return err