add missing extensions

Signed-off-by: Christian Richter <crichter@owncloud.com>
This commit is contained in:
Christian Richter
2022-04-20 12:20:37 +02:00
parent 88cf3eec89
commit f7a84491ef
4 changed files with 40 additions and 22 deletions

View File

@@ -22,9 +22,9 @@ type Config struct {
// Notifications definces the config options for the notifications service.
type Notifications struct {
SMTP SMTP `yaml:"SMTP"`
Events Events `yaml:"events"`
RevaGateway string `yaml:"reva_gateway" env:"REVA_GATEWAY;NOTIFICATIONS_REVA_GATEWAY"`
SMTP SMTP `yaml:"SMTP,omitempty"`
Events Events `yaml:"events,omitempty"`
RevaGateway string `yaml:"reva_gateway,omitempty" env:"REVA_GATEWAY;NOTIFICATIONS_REVA_GATEWAY"`
MachineAuthSecret string `yaml:"machine_auth_api_key" env:"OCIS_MACHINE_AUTH_API_KEY;NOTIFICATIONS_MACHINE_AUTH_API_KEY"`
}

View File

@@ -36,10 +36,10 @@ type Asset struct {
// Metadata configures the metadata store to use
type Metadata struct {
GatewayAddress string `yaml:"gateway_addr" env:"STORAGE_GATEWAY_GRPC_ADDR"`
StorageAddress string `yaml:"storage_addr" env:"STORAGE_GRPC_ADDR"`
GatewayAddress string `yaml:"gateway_addr,omitempty" env:"STORAGE_GATEWAY_GRPC_ADDR"`
StorageAddress string `yaml:"storage_addr,omitempty" env:"STORAGE_GRPC_ADDR"`
ServiceUserID string `yaml:"service_user_id" env:"METADATA_SERVICE_USER_UUID"`
ServiceUserIDP string `yaml:"service_user_idp" env:"OCIS_URL;METADATA_SERVICE_USER_IDP"`
MachineAuthAPIKey string `yaml:"machine_auth_api_key" env:"OCIS_MACHINE_AUTH_API_KEY"`
ServiceUserID string `yaml:"service_user_id,omitempty" env:"METADATA_SERVICE_USER_UUID"`
ServiceUserIDP string `yaml:"service_user_idp,omitempty" env:"OCIS_URL;METADATA_SERVICE_USER_IDP"`
MachineAuthAPIKey string `yaml:"machine_auth_api_key,omitempty" env:"OCIS_MACHINE_AUTH_API_KEY"`
}

View File

@@ -36,12 +36,12 @@ type FileSystemSource struct {
// Thumbnail defines the available thumbnail related configuration.
type Thumbnail struct {
Resolutions []string `yaml:"resolutions"`
FileSystemStorage FileSystemStorage `yaml:"filesystem_storage"`
WebdavAllowInsecure bool `yaml:"webdav_allow_insecure" env:"OCIS_INSECURE;THUMBNAILS_WEBDAVSOURCE_INSECURE"`
CS3AllowInsecure bool `yaml:"cs3_allow_insecure" env:"OCIS_INSECURE;THUMBNAILS_CS3SOURCE_INSECURE"`
RevaGateway string `yaml:"reva_gateway" env:"REVA_GATEWAY"` //TODO: use REVA config
FontMapFile string `yaml:"font_map_file" env:"THUMBNAILS_TXT_FONTMAP_FILE"`
TransferTokenSecret string `yaml:"transfer_token" env:"THUMBNAILS_TRANSFER_TOKEN"`
DataEndpoint string `yaml:"data_endpoint" env:"THUMBNAILS_DATA_ENDPOINT"`
Resolutions []string `yaml:"resolutions,omitempty"`
FileSystemStorage FileSystemStorage `yaml:"filesystem_storage,omitempty"`
WebdavAllowInsecure bool `yaml:"webdav_allow_insecure,omitempty" env:"OCIS_INSECURE;THUMBNAILS_WEBDAVSOURCE_INSECURE"`
CS3AllowInsecure bool `yaml:"cs3_allow_insecure,omitempty" env:"OCIS_INSECURE;THUMBNAILS_CS3SOURCE_INSECURE"`
RevaGateway string `yaml:"reva_gateway,omitempty" env:"REVA_GATEWAY"` //TODO: use REVA config
FontMapFile string `yaml:"font_map_file,omitempty" env:"THUMBNAILS_TXT_FONTMAP_FILE"`
TransferTokenSecret string `yaml:"transfer_token,omitempty" env:"THUMBNAILS_TRANSFER_TOKEN"`
DataEndpoint string `yaml:"data_endpoint,omitempty" env:"THUMBNAILS_DATA_ENDPOINT"`
}

View File

@@ -19,7 +19,11 @@ import (
accounts "github.com/owncloud/ocis/extensions/accounts/pkg/config"
graph "github.com/owncloud/ocis/extensions/graph/pkg/config"
idm "github.com/owncloud/ocis/extensions/idm/pkg/config"
notifications "github.com/owncloud/ocis/extensions/notifications/pkg/config"
ocs "github.com/owncloud/ocis/extensions/ocs/pkg/config"
proxy "github.com/owncloud/ocis/extensions/proxy/pkg/config"
settings "github.com/owncloud/ocis/extensions/settings/pkg/config"
thumbnails "github.com/owncloud/ocis/extensions/thumbnails/pkg/config"
)
const configFilename string = "ocis.yml"
@@ -105,17 +109,17 @@ func createConfig(insecure, forceOverwrite bool, configPath string) error {
IDM: &idm.Config{},
//IDP: &idp.Config{},
//Nats: &nats.Config{},
//Notifications: &notifications.Config{},
//OCS: &ocs.Config{},
//Settings: &settings.Config{},
Notifications: &notifications.Config{},
Proxy: &proxy.Config{},
OCS: &ocs.Config{},
Settings: &settings.Config{},
//Storage: &storage.Config{},
//Thumbnails: &thumbnails.Config{},
Thumbnails: &thumbnails.Config{},
//Web: &web.Config{},
//WebDAV: &webdav.Config{},
}
if insecure {
cfg.Proxy = &proxy.Config{}
cfg.Proxy.InsecureBackends = insecure
}
@@ -139,8 +143,15 @@ func createConfig(insecure, forceOverwrite bool, configPath string) error {
if err != nil {
return fmt.Errorf("Could not generate random password for tokenmanager: %s", err)
}
machineAuthSecret, err := generateRandomPassword(passwordLength)
if err != nil {
return fmt.Errorf("Could not generate random password for machineauthsecret: %s", err)
}
thumbnailTransferTokenSecret, err := generateRandomPassword(passwordLength)
if err != nil {
return fmt.Errorf("Could not generate random password for machineauthsecret: %s", err)
}
// TODO: generate outputs for all occurences above
cfg.TokenManager.JWTSecret = tokenManagerJwtSecret
cfg.Accounts.TokenManager.JWTSecret = tokenManagerJwtSecret
cfg.Graph.TokenManager.JWTSecret = tokenManagerJwtSecret
@@ -148,6 +159,13 @@ func createConfig(insecure, forceOverwrite bool, configPath string) error {
cfg.IDM.ServiceUserPasswords.Idp = idpServicePassword
cfg.IDM.ServiceUserPasswords.OcisAdmin = ocisAdminServicePassword
cfg.IDM.ServiceUserPasswords.Reva = revaServicePassword
cfg.Notifications.Notifications.MachineAuthSecret = machineAuthSecret
cfg.OCS.MachineAuthAPIKey = machineAuthSecret
cfg.Proxy.TokenManager.JWTSecret = tokenManagerJwtSecret
cfg.Proxy.MachineAuthAPIKey = machineAuthSecret
cfg.Settings.Metadata.MachineAuthAPIKey = machineAuthSecret
cfg.Settings.TokenManager.JWTSecret = tokenManagerJwtSecret
cfg.Thumbnails.Thumbnail.TransferTokenSecret = thumbnailTransferTokenSecret
yamlOutput, err := yaml.Marshal(cfg)
if err != nil {
return fmt.Errorf("Could not marshall config into yaml: %s", err)