let ocis init set the serviceaccounts
Signed-off-by: jkoberg <jkoberg@owncloud.com>
This commit is contained in:
+53
-9
@@ -55,10 +55,11 @@ type GraphApplication struct {
|
||||
}
|
||||
|
||||
type GraphService struct {
|
||||
Application GraphApplication
|
||||
Events Events
|
||||
Spaces InsecureService
|
||||
Identity LdapBasedService
|
||||
Application GraphApplication
|
||||
Events Events
|
||||
Spaces InsecureService
|
||||
Identity LdapBasedService
|
||||
ServiceAccount ServiceAccount `yaml:"service_account"`
|
||||
}
|
||||
|
||||
type ServiceUserPasswordsSettings struct {
|
||||
@@ -101,7 +102,8 @@ type ThumbnailService struct {
|
||||
}
|
||||
|
||||
type Search struct {
|
||||
Events Events
|
||||
Events Events
|
||||
ServiceAccount ServiceAccount `yaml:"service_account"`
|
||||
}
|
||||
|
||||
type Audit struct {
|
||||
@@ -113,8 +115,9 @@ type Sharing struct {
|
||||
}
|
||||
|
||||
type StorageUsers struct {
|
||||
Events Events
|
||||
MountID string `yaml:"mount_id"`
|
||||
Events Events
|
||||
MountID string `yaml:"mount_id"`
|
||||
ServiceAccount ServiceAccount `yaml:"service_account"`
|
||||
}
|
||||
|
||||
type Gateway struct {
|
||||
@@ -126,7 +129,16 @@ type StorageRegistry struct {
|
||||
}
|
||||
|
||||
type Notifications struct {
|
||||
Notifications struct{ Events Events } // The notifications config has a field called notifications
|
||||
Notifications struct{ Events Events } // The notifications config has a field called notifications
|
||||
ServiceAccount ServiceAccount `yaml:"service_account"`
|
||||
}
|
||||
|
||||
type Userlog struct {
|
||||
ServiceAccount ServiceAccount `yaml:"service_account"`
|
||||
}
|
||||
|
||||
type AuthService struct {
|
||||
ServiceAccount ServiceAccount `yaml:"service_account"`
|
||||
}
|
||||
|
||||
type Nats struct {
|
||||
@@ -136,6 +148,12 @@ type Nats struct {
|
||||
}
|
||||
}
|
||||
|
||||
// ServiceAccount is the configuration for the used service account
|
||||
type ServiceAccount struct {
|
||||
ServiceAccountID string `yaml:"service_account_id"`
|
||||
ServiceAccountSecret string `yaml:"service_account_secret"`
|
||||
}
|
||||
|
||||
// TODO: use the oCIS config struct instead of this custom struct
|
||||
// We can't use it right now, because it would need "omitempty" on
|
||||
// all elements, in order to produce a slim config file with `ocis init`.
|
||||
@@ -173,6 +191,8 @@ type OcisConfig struct {
|
||||
Notifications Notifications
|
||||
Nats Nats
|
||||
Gateway Gateway
|
||||
Userlog Userlog
|
||||
AuthService AuthService `yaml:"auth_service"`
|
||||
}
|
||||
|
||||
func checkConfigPath(configPath string) error {
|
||||
@@ -225,6 +245,7 @@ func CreateConfig(insecure, forceOverwrite bool, configPath, adminPassword strin
|
||||
adminUserID := uuid.Must(uuid.NewV4()).String()
|
||||
graphApplicationID := uuid.Must(uuid.NewV4()).String()
|
||||
storageUsersMountID := uuid.Must(uuid.NewV4()).String()
|
||||
serviceAccountID := uuid.Must(uuid.NewV4()).String()
|
||||
|
||||
idmServicePassword, err := generators.GenerateRandomPassword(passwordLength)
|
||||
if err != nil {
|
||||
@@ -266,6 +287,15 @@ func CreateConfig(insecure, forceOverwrite bool, configPath, adminPassword strin
|
||||
if err != nil {
|
||||
return fmt.Errorf("could not generate random password for thumbnailsTransferSecret: %s", err)
|
||||
}
|
||||
serviceAccountSecret, err := generators.GenerateRandomPassword(passwordLength)
|
||||
if err != nil {
|
||||
return fmt.Errorf("could not generate random password for thumbnailsTransferSecret: %s", err)
|
||||
}
|
||||
|
||||
serviceAccount := ServiceAccount{
|
||||
ServiceAccountID: serviceAccountID,
|
||||
ServiceAccountSecret: serviceAccountSecret,
|
||||
}
|
||||
|
||||
cfg := OcisConfig{
|
||||
TokenManager: TokenManager{
|
||||
@@ -319,6 +349,7 @@ func CreateConfig(insecure, forceOverwrite bool, configPath, adminPassword strin
|
||||
BindPassword: idmServicePassword,
|
||||
},
|
||||
},
|
||||
ServiceAccount: serviceAccount,
|
||||
},
|
||||
Thumbnails: ThumbnailService{
|
||||
Thumbnail: ThumbnailSettings{
|
||||
@@ -331,7 +362,20 @@ func CreateConfig(insecure, forceOverwrite bool, configPath, adminPassword strin
|
||||
},
|
||||
},
|
||||
StorageUsers: StorageUsers{
|
||||
MountID: storageUsersMountID,
|
||||
MountID: storageUsersMountID,
|
||||
ServiceAccount: serviceAccount,
|
||||
},
|
||||
Userlog: Userlog{
|
||||
ServiceAccount: serviceAccount,
|
||||
},
|
||||
AuthService: AuthService{
|
||||
ServiceAccount: serviceAccount,
|
||||
},
|
||||
Search: Search{
|
||||
ServiceAccount: serviceAccount,
|
||||
},
|
||||
Notifications: Notifications{
|
||||
ServiceAccount: serviceAccount,
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
@@ -32,10 +32,6 @@ func DefaultConfig() *config.Config {
|
||||
Name: "auth-service",
|
||||
},
|
||||
Reva: shared.DefaultRevaConfig(),
|
||||
ServiceAccount: config.ServiceAccount{
|
||||
ServiceAccountID: "service-user-id",
|
||||
ServiceAccountSecret: "secret-string",
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -105,10 +105,6 @@ func DefaultConfig() *config.Config {
|
||||
Cluster: "ocis-cluster",
|
||||
EnableTLS: false,
|
||||
},
|
||||
ServiceAccount: config.ServiceAccount{
|
||||
ServiceAccountID: "service-user-id",
|
||||
ServiceAccountSecret: "secret-string",
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -44,10 +44,6 @@ func DefaultConfig() *config.Config {
|
||||
},
|
||||
RevaGateway: shared.DefaultRevaConfig().Address,
|
||||
},
|
||||
ServiceAccount: config.ServiceAccount{
|
||||
ServiceAccountID: "service-user-id",
|
||||
ServiceAccountSecret: "secret-string",
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -54,10 +54,6 @@ func DefaultConfig() *config.Config {
|
||||
EnableTLS: false,
|
||||
},
|
||||
ContentExtractionSizeLimit: 20 * 1024 * 1024, // Limit content extraction to <20MB files by default
|
||||
ServiceAccount: config.ServiceAccount{
|
||||
ServiceAccountID: "service-user-id",
|
||||
ServiceAccountSecret: "secret-string",
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -108,10 +108,6 @@ func DefaultConfig() *config.Config {
|
||||
PersonalDeleteBefore: 30 * 24 * time.Hour,
|
||||
},
|
||||
},
|
||||
ServiceAccount: config.ServiceAccount{
|
||||
ServiceAccountID: "service-user-id",
|
||||
ServiceAccountSecret: "secret-string",
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -52,10 +52,6 @@ func DefaultConfig() *config.Config {
|
||||
AllowCredentials: true,
|
||||
},
|
||||
},
|
||||
ServiceAccount: config.ServiceAccount{
|
||||
ServiceAccountID: "service-user-id",
|
||||
ServiceAccountSecret: "secret-string",
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user