MachineAuthAPIKey -> SystemUserAPIKey (#3672)
* split machineauthapikey and systemuserapikey Signed-off-by: jkoberg <jkoberg@owncloud.com> * changelog Signed-off-by: jkoberg <jkoberg@owncloud.com> * specific errors and some reverts Signed-off-by: jkoberg <jkoberg@owncloud.com> * use correct machine auth api key Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de> Co-authored-by: Jörn Friedrich Dreyer <jfd@butonic.de>
This commit is contained in:
co-authored by
Jörn Friedrich Dreyer
parent
2bd63509e3
commit
eb59d2291e
@@ -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"`
|
||||
MachineAuthAPIKey string `yaml:"machine_auth_api_key" env:"OCIS_MACHINE_AUTH_API_KEY"`
|
||||
ServiceUserID string `yaml:"service_user_id" env:"METADATA_SERVICE_USER_UUID"`
|
||||
ServiceUserIDP string `yaml:"service_user_idp" env:"METADATA_SERVICE_USER_IDP"`
|
||||
SystemUserAPIKey string `yaml:"system_user_api_key" env:"OCIS_SYSTEM_USER_API_KEY"`
|
||||
}
|
||||
|
||||
@@ -89,8 +89,8 @@ func EnsureDefaults(cfg *config.Config) {
|
||||
cfg.TokenManager = &config.TokenManager{}
|
||||
}
|
||||
|
||||
if cfg.Metadata.MachineAuthAPIKey == "" && cfg.Commons != nil && cfg.Commons.MachineAuthAPIKey != "" {
|
||||
cfg.Metadata.MachineAuthAPIKey = cfg.Commons.MachineAuthAPIKey
|
||||
if cfg.Metadata.SystemUserAPIKey == "" && cfg.Commons != nil && cfg.Commons.SystemUserAPIKey != "" {
|
||||
cfg.Metadata.SystemUserAPIKey = cfg.Commons.SystemUserAPIKey
|
||||
}
|
||||
|
||||
if cfg.Metadata.ServiceUserID == "" && cfg.Commons != nil && cfg.Commons.SystemUserID != "" {
|
||||
|
||||
@@ -37,8 +37,8 @@ func Validate(cfg *config.Config) error {
|
||||
return shared.MissingJWTTokenError(cfg.Service.Name)
|
||||
}
|
||||
|
||||
if cfg.Metadata.MachineAuthAPIKey == "" {
|
||||
return shared.MissingMachineAuthApiKeyError(cfg.Service.Name)
|
||||
if cfg.Metadata.SystemUserAPIKey == "" {
|
||||
return shared.MissingSystemUserApiKeyError(cfg.Service.Name)
|
||||
}
|
||||
|
||||
if cfg.AdminUserID == "" {
|
||||
|
||||
@@ -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.MachineAuthAPIKey)
|
||||
mdc, err := metadata.NewCS3Storage(cfg.GatewayAddress, cfg.StorageAddress, cfg.ServiceUserID, cfg.ServiceUserIDP, cfg.SystemUserAPIKey)
|
||||
if err != nil {
|
||||
log.Fatal("error connecting to mdc:", err)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user