Skip to content

Commit

Permalink
ServiceUser -> SystemUser (#3673)
Browse files Browse the repository at this point in the history
* serviceUser -> systemUser

Signed-off-by: jkoberg <[email protected]>

* changelog

Signed-off-by: jkoberg <[email protected]>

* leave out OCIS_URL, cleanup

Signed-off-by: Jörn Friedrich Dreyer <[email protected]>

Co-authored-by: Jörn Friedrich Dreyer <[email protected]>
  • Loading branch information
kobergj and butonic authored May 4, 2022
1 parent d7d9d76 commit 25dc46e
Show file tree
Hide file tree
Showing 8 changed files with 30 additions and 24 deletions.
6 changes: 6 additions & 0 deletions changelog/unreleased/serviceUser-systemUser.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Change: rename serviceUser to systemUser

We renamed serviceUser to systemUser in all configs and vars
including yaml-tags and env vars

https://github.com/owncloud/ocis/pull/3673
4 changes: 2 additions & 2 deletions extensions/settings/pkg/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ type Metadata struct {
GatewayAddress string `yaml:"gateway_addr" env:"STORAGE_GATEWAY_GRPC_ADDR"`
StorageAddress string `yaml:"storage_addr" env:"STORAGE_GRPC_ADDR"`

ServiceUserID string `yaml:"service_user_id" env:"METADATA_SERVICE_USER_UUID"`
ServiceUserIDP string `yaml:"service_user_idp" env:"METADATA_SERVICE_USER_IDP"`
SystemUserID string `yaml:"system_user_id" env:"OCIS_SYSTEM_USER_ID;SETTINGS_SYSTEM_USER_ID"`
SystemUserIDP string `yaml:"system_user_idp" env:"OCIS_SYSTEM_USER_IDP;SETTINGS_SYSTEM_USER_IDP"`
SystemUserAPIKey string `yaml:"system_user_api_key" env:"OCIS_SYSTEM_USER_API_KEY"`
}
6 changes: 3 additions & 3 deletions extensions/settings/pkg/config/defaults/defaultconfig.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ func DefaultConfig() *config.Config {
Metadata: config.Metadata{
GatewayAddress: "127.0.0.1:9215", // system storage
StorageAddress: "127.0.0.1:9215",
ServiceUserIDP: "internal",
SystemUserIDP: "internal",
},
}
}
Expand Down Expand Up @@ -93,8 +93,8 @@ func EnsureDefaults(cfg *config.Config) {
cfg.Metadata.SystemUserAPIKey = cfg.Commons.SystemUserAPIKey
}

if cfg.Metadata.ServiceUserID == "" && cfg.Commons != nil && cfg.Commons.SystemUserID != "" {
cfg.Metadata.ServiceUserID = cfg.Commons.SystemUserID
if cfg.Metadata.SystemUserID == "" && cfg.Commons != nil && cfg.Commons.SystemUserID != "" {
cfg.Metadata.SystemUserID = cfg.Commons.SystemUserID
}
}

Expand Down
2 changes: 1 addition & 1 deletion extensions/settings/pkg/store/metadata/store.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ func New(cfg *config.Config) settings.Manager {

// NewMetadataClient returns the MetadataClient
func NewMetadataClient(cfg config.Metadata) MetadataClient {
mdc, err := metadata.NewCS3Storage(cfg.GatewayAddress, cfg.StorageAddress, cfg.ServiceUserID, cfg.ServiceUserIDP, cfg.SystemUserAPIKey)
mdc, err := metadata.NewCS3Storage(cfg.GatewayAddress, cfg.StorageAddress, cfg.SystemUserID, cfg.SystemUserIDP, cfg.SystemUserAPIKey)
if err != nil {
log.Fatal("error connecting to mdc:", err)
}
Expand Down
8 changes: 4 additions & 4 deletions extensions/sharing/pkg/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,8 @@ type UserSharingOwnCloudSQLDriver struct {

type UserSharingCS3Driver struct {
ProviderAddr string `yaml:"provider_addr" env:"SHARING_USER_CS3_PROVIDER_ADDR"`
ServiceUserID string `yaml:"service_user_id" env:"SHARING_USER_CS3_SERVICE_USER_ID"`
ServiceUserIDP string `yaml:"service_user_idp" env:"OCIS_URL;SHARING_USER_CS3_SERVICE_USER_IDP"`
SystemUserID string `yaml:"system_user_id" env:"OCIS_SYSTEM_USER_ID;SHARING_USER_CS3_SYSTEM_USER_ID"`
SystemUserIDP string `yaml:"system_user_idp" env:"OCIS_SYSTEM_USER_IDP;SHARING_USER_CS3_SYSTEM_USER_IDP"`
SystemUserAPIKey string `yaml:"system_user_api_key" env:"OCIS_SYSTEM_USER_API_KEY;SHARING_USER_CS3_SYSTEM_USER_API_KEY"`
}

Expand Down Expand Up @@ -125,8 +125,8 @@ type PublicSharingSQLDriver struct {

type PublicSharingCS3Driver struct {
ProviderAddr string `yaml:"provider_addr" env:"SHARING_PUBLIC_CS3_PROVIDER_ADDR"`
ServiceUserID string `yaml:"service_user_id" env:"SHARING_PUBLIC_CS3_SERVICE_USER_ID"`
ServiceUserIDP string `yaml:"service_user_idp" env:"OCIS_URL;SHARING_PUBLIC_CS3_SERVICE_USER_IDP"`
SystemUserID string `yaml:"system_user_id" env:"OCIS_SYSTEM_USER_ID;SHARING_PUBLIC_CS3_SYSTEM_USER_ID"`
SystemUserIDP string `yaml:"system_user_idp" env:"OCIS_SYSTEM_USER_IDP;SHARING_PUBLIC_CS3_SYSTEM_USER_IDP"`
SystemUserAPIKey string `yaml:"system_user_api_key" env:"OCIS_SYSTEM_USER_API_KEY;SHARING_USER_CS3_SYSTEM_USER_API_KEY"`
}

Expand Down
16 changes: 8 additions & 8 deletions extensions/sharing/pkg/config/defaults/defaultconfig.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ func DefaultConfig() *config.Config {
File: filepath.Join(defaults.BaseDataPath(), "storage", "shares.json"),
},
CS3: config.UserSharingCS3Driver{
ProviderAddr: "127.0.0.1:9215", // metadata storage
ServiceUserIDP: "internal",
ProviderAddr: "127.0.0.1:9215", // metadata storage
SystemUserIDP: "internal",
},
},
PublicSharingDriver: "json", // "cs3",
Expand All @@ -49,8 +49,8 @@ func DefaultConfig() *config.Config {
File: filepath.Join(defaults.BaseDataPath(), "storage", "publicshares.json"),
},
CS3: config.PublicSharingCS3Driver{
ProviderAddr: "127.0.0.1:9215", // metadata storage
ServiceUserIDP: "internal",
ProviderAddr: "127.0.0.1:9215", // metadata storage
SystemUserIDP: "internal",
},
},
Events: config.Events{
Expand Down Expand Up @@ -104,16 +104,16 @@ func EnsureDefaults(cfg *config.Config) {
cfg.UserSharingDrivers.CS3.SystemUserAPIKey = cfg.Commons.SystemUserAPIKey
}

if cfg.UserSharingDrivers.CS3.ServiceUserID == "" && cfg.Commons != nil && cfg.Commons.SystemUserID != "" {
cfg.UserSharingDrivers.CS3.ServiceUserID = cfg.Commons.SystemUserID
if cfg.UserSharingDrivers.CS3.SystemUserID == "" && cfg.Commons != nil && cfg.Commons.SystemUserID != "" {
cfg.UserSharingDrivers.CS3.SystemUserID = cfg.Commons.SystemUserID
}

if cfg.PublicSharingDrivers.CS3.SystemUserAPIKey == "" && cfg.Commons != nil && cfg.Commons.SystemUserAPIKey != "" {
cfg.PublicSharingDrivers.CS3.SystemUserAPIKey = cfg.Commons.SystemUserAPIKey
}

if cfg.PublicSharingDrivers.CS3.ServiceUserID == "" && cfg.Commons != nil && cfg.Commons.SystemUserID != "" {
cfg.PublicSharingDrivers.CS3.ServiceUserID = cfg.Commons.SystemUserID
if cfg.PublicSharingDrivers.CS3.SystemUserID == "" && cfg.Commons != nil && cfg.Commons.SystemUserID != "" {
cfg.PublicSharingDrivers.CS3.SystemUserID = cfg.Commons.SystemUserID
}
}

Expand Down
4 changes: 2 additions & 2 deletions extensions/sharing/pkg/config/parser/parse.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,15 +42,15 @@ func Validate(cfg *config.Config) error {
return shared.MissingSystemUserApiKeyError(cfg.Service.Name)
}

if cfg.PublicSharingDriver == "cs3" && cfg.PublicSharingDrivers.CS3.ServiceUserID == "" {
if cfg.PublicSharingDriver == "cs3" && cfg.PublicSharingDrivers.CS3.SystemUserID == "" {
return shared.MissingSystemUserID(cfg.Service.Name)
}

if cfg.UserSharingDriver == "cs3" && cfg.UserSharingDrivers.CS3.SystemUserAPIKey == "" {
return shared.MissingSystemUserApiKeyError(cfg.Service.Name)
}

if cfg.UserSharingDriver == "cs3" && cfg.UserSharingDrivers.CS3.ServiceUserID == "" {
if cfg.UserSharingDriver == "cs3" && cfg.UserSharingDrivers.CS3.SystemUserID == "" {
return shared.MissingSystemUserID(cfg.Service.Name)
}

Expand Down
8 changes: 4 additions & 4 deletions extensions/sharing/pkg/revaconfig/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ func SharingConfigFromStruct(cfg *config.Config) map[string]interface{} {
},
"cs3": map[string]interface{}{
"provider_addr": cfg.UserSharingDrivers.CS3.ProviderAddr,
"service_user_id": cfg.UserSharingDrivers.CS3.ServiceUserID,
"service_user_idp": cfg.UserSharingDrivers.CS3.ServiceUserIDP,
"service_user_id": cfg.UserSharingDrivers.CS3.SystemUserID,
"service_user_idp": cfg.UserSharingDrivers.CS3.SystemUserIDP,
"machine_auth_apikey": cfg.UserSharingDrivers.CS3.SystemUserAPIKey,
},
},
Expand All @@ -75,8 +75,8 @@ func SharingConfigFromStruct(cfg *config.Config) map[string]interface{} {
},
"cs3": map[string]interface{}{
"provider_addr": cfg.PublicSharingDrivers.CS3.ProviderAddr,
"service_user_id": cfg.PublicSharingDrivers.CS3.ServiceUserID,
"service_user_idp": cfg.PublicSharingDrivers.CS3.ServiceUserIDP,
"service_user_id": cfg.PublicSharingDrivers.CS3.SystemUserID,
"service_user_idp": cfg.PublicSharingDrivers.CS3.SystemUserIDP,
"machine_auth_apikey": cfg.PublicSharingDrivers.CS3.SystemUserAPIKey,
},
},
Expand Down

0 comments on commit 25dc46e

Please sign in to comment.