From d106c87c518190edcae3c13d48158d2b2b99c6a7 Mon Sep 17 00:00:00 2001 From: Christian Richter Date: Wed, 27 Apr 2022 10:37:40 +0200 Subject: [PATCH] [WIP] adapt storage changes Signed-off-by: Christian Richter --- extensions/appprovider/pkg/config/config.go | 22 +++---- extensions/auth-basic/pkg/config/config.go | 20 +++---- extensions/auth-bearer/pkg/config/config.go | 20 +++---- extensions/auth-machine/pkg/config/config.go | 20 +++---- extensions/gateway/pkg/config/config.go | 60 +++++++++---------- extensions/group/pkg/config/config.go | 22 +++---- extensions/ocdav/pkg/config/config.go | 32 +++++----- extensions/sharing/pkg/config/config.go | 26 ++++---- .../storage-metadata/pkg/config/config.go | 30 +++++----- .../storage-publiclink/pkg/config/config.go | 22 +++---- .../storage-shares/pkg/config/config.go | 24 ++++---- extensions/storage-users/pkg/config/config.go | 38 ++++++------ extensions/user/pkg/config/config.go | 22 +++---- ocis/pkg/command/init.go | 49 +++++++++++++-- 14 files changed, 224 insertions(+), 183 deletions(-) diff --git a/extensions/appprovider/pkg/config/config.go b/extensions/appprovider/pkg/config/config.go index 72645eee8..42efec470 100644 --- a/extensions/appprovider/pkg/config/config.go +++ b/extensions/appprovider/pkg/config/config.go @@ -5,19 +5,19 @@ import "github.com/owncloud/ocis/ocis-pkg/shared" type Config struct { *shared.Commons `yaml:"-"` Service Service `yaml:"-"` - Tracing *Tracing `yaml:"tracing"` - Logging *Logging `yaml:"log"` - Debug Debug `yaml:"debug"` - Supervised bool + Tracing *Tracing `yaml:"tracing,omitempty"` + Logging *Logging `yaml:"log,omitempty"` + Debug Debug `yaml:"debug,omitempty"` + Supervised bool `yaml:"supervised,omitempty"` - GRPC GRPCConfig `yaml:"grpc"` + GRPC GRPCConfig `yaml:"grpc,omitempty"` - JWTSecret string - GatewayEndpoint string - SkipUserGroupsInToken bool - ExternalAddr string - Driver string - Drivers Drivers + JWTSecret string `yaml:"jwt_secret,omitempty"` + GatewayEndpoint string `yaml:"gateway_endpoint,omitempty"` + SkipUserGroupsInToken bool `yaml:"skip_user_groups_in_token,omitempty"` + ExternalAddr string `yaml:"external_addr,omitempty"` + Driver string `yaml:"driver,omitempty"` + Drivers Drivers `yaml:"drivers,omitempty"` } type Tracing struct { diff --git a/extensions/auth-basic/pkg/config/config.go b/extensions/auth-basic/pkg/config/config.go index 8557e3e7f..04eb2649a 100644 --- a/extensions/auth-basic/pkg/config/config.go +++ b/extensions/auth-basic/pkg/config/config.go @@ -5,18 +5,18 @@ import "github.com/owncloud/ocis/ocis-pkg/shared" type Config struct { *shared.Commons `yaml:"-"` Service Service `yaml:"-"` - Tracing *Tracing `yaml:"tracing"` - Logging *Logging `yaml:"log"` - Debug Debug `yaml:"debug"` - Supervised bool + Tracing *Tracing `yaml:"tracing,omitempty"` + Logging *Logging `yaml:"log,omitempty"` + Debug Debug `yaml:"debug,omitempty"` + Supervised bool `yaml:"supervised,omitempty"` - GRPC GRPCConfig `yaml:"grpc"` + GRPC GRPCConfig `yaml:"grpc,omitempty"` - JWTSecret string - GatewayEndpoint string - SkipUserGroupsInToken bool - AuthProvider string `yaml:"auth_provider" env:"AUTH_BASIC_AUTH_PROVIDER" desc:"The auth provider which should be used by the service"` - AuthProviders AuthProviders `yaml:"auth_providers"` + JWTSecret string `yaml:"jwt_secret,omitempty"` + GatewayEndpoint string `yaml:"gateway_endpoint,omitempty"` + SkipUserGroupsInToken bool `yaml:"skip_user_groups_in_token,omitempty"` + AuthProvider string `yaml:"auth_provider,omitempty" env:"AUTH_BASIC_AUTH_PROVIDER" desc:"The auth provider which should be used by the service"` + AuthProviders AuthProviders `yaml:"auth_providers,omitempty"` } type Tracing struct { Enabled bool `yaml:"enabled" env:"OCIS_TRACING_ENABLED;AUTH_BASIC_TRACING_ENABLED" desc:"Activates tracing."` diff --git a/extensions/auth-bearer/pkg/config/config.go b/extensions/auth-bearer/pkg/config/config.go index 0bc26ab12..b7c8fad6e 100644 --- a/extensions/auth-bearer/pkg/config/config.go +++ b/extensions/auth-bearer/pkg/config/config.go @@ -5,18 +5,18 @@ import "github.com/owncloud/ocis/ocis-pkg/shared" type Config struct { *shared.Commons `yaml:"-"` Service Service `yaml:"-"` - Tracing *Tracing `yaml:"tracing"` - Logging *Logging `yaml:"log"` - Debug Debug `yaml:"debug"` - Supervised bool + Tracing *Tracing `yaml:"tracing,omitempty"` + Logging *Logging `yaml:"log,omitempty"` + Debug Debug `yaml:"debug,omitempty"` + Supervised bool `yaml:"supervised,omitempty"` - GRPC GRPCConfig `yaml:"grpc"` + GRPC GRPCConfig `yaml:"grpc,omitempty"` - JWTSecret string - GatewayEndpoint string - SkipUserGroupsInToken bool - AuthProvider string `yaml:"auth_provider" env:"AUTH_BEARER_AUTH_PROVIDER" desc:"The auth provider which should be used by the service"` - AuthProviders AuthProviders `yaml:"auth_providers"` + JWTSecret string `yaml:"jwt_secret,omitempty"` + GatewayEndpoint string `yaml:"gateway_endpoint,omitempty"` + SkipUserGroupsInToken bool `yaml:"skip_user_groups_in_token,omitempty"` + AuthProvider string `yaml:"auth_provider,omitempty" env:"AUTH_BEARER_AUTH_PROVIDER" desc:"The auth provider which should be used by the service"` + AuthProviders AuthProviders `yaml:"auth_providers,omitempty"` } type Tracing struct { Enabled bool `yaml:"enabled" env:"OCIS_TRACING_ENABLED;AUTH_BEARER_TRACING_ENABLED" desc:"Activates tracing."` diff --git a/extensions/auth-machine/pkg/config/config.go b/extensions/auth-machine/pkg/config/config.go index 50a2db2c1..0e530daf1 100644 --- a/extensions/auth-machine/pkg/config/config.go +++ b/extensions/auth-machine/pkg/config/config.go @@ -5,18 +5,18 @@ import "github.com/owncloud/ocis/ocis-pkg/shared" type Config struct { *shared.Commons `yaml:"-"` Service Service `yaml:"-"` - Tracing *Tracing `yaml:"tracing"` - Logging *Logging `yaml:"log"` - Debug Debug `yaml:"debug"` - Supervised bool + Tracing *Tracing `yaml:"tracing,omitempty"` + Logging *Logging `yaml:"log,omitempty"` + Debug Debug `yaml:"debug,omitempty"` + Supervised bool `yaml:"supervised,omitempty"` - GRPC GRPCConfig `yaml:"grpc"` + GRPC GRPCConfig `yaml:"grpc,omitempty"` - JWTSecret string - GatewayEndpoint string - SkipUserGroupsInToken bool - AuthProvider string `yaml:"auth_provider" env:"AUTH_MACHINE_AUTH_PROVIDER" desc:"The auth provider which should be used by the service"` - AuthProviders AuthProviders `yaml:"auth_providers"` + JWTSecret string `yaml:"jwt_secret,omitempty"` + GatewayEndpoint string `yaml:"gateway_entpoint,omitempty"` + SkipUserGroupsInToken bool `yaml:"skip_user_groups_in_token,omitempty"` + AuthProvider string `yaml:"auth_provider,omitempty" env:"AUTH_MACHINE_AUTH_PROVIDER" desc:"The auth provider which should be used by the service"` + AuthProviders AuthProviders `yaml:"auth_providers,omitempty"` } type Tracing struct { Enabled bool `yaml:"enabled" env:"OCIS_TRACING_ENABLED;AUTH_MACHINE_TRACING_ENABLED" desc:"Activates tracing."` diff --git a/extensions/gateway/pkg/config/config.go b/extensions/gateway/pkg/config/config.go index 740fa151f..bf16e5f3d 100644 --- a/extensions/gateway/pkg/config/config.go +++ b/extensions/gateway/pkg/config/config.go @@ -5,41 +5,41 @@ import "github.com/owncloud/ocis/ocis-pkg/shared" type Config struct { *shared.Commons `yaml:"-"` Service Service `yaml:"-"` - Tracing *Tracing `yaml:"tracing"` - Logging *Logging `yaml:"log"` - Debug Debug `yaml:"debug"` - Supervised bool + Tracing *Tracing `yaml:"tracing,omitempty"` + Logging *Logging `yaml:"log,omitempty"` + Debug Debug `yaml:"debug,omitempty"` + Supervised bool `yaml:"supervised,omitempty"` - GRPC GRPCConfig `yaml:"grpc"` + GRPC GRPCConfig `yaml:"grpc,omitempty"` - JWTSecret string - GatewayEndpoint string - SkipUserGroupsInToken bool + JWTSecret string `yaml:"jwt_secret,omitempty"` + GatewayEndpoint string `yaml:",omitempty"` + SkipUserGroupsInToken bool `yaml:",omitempty"` - CommitShareToStorageGrant bool - CommitShareToStorageRef bool - ShareFolder string - DisableHomeCreationOnLogin bool - TransferSecret string `env:"STORAGE_TRANSFER_SECRET"` - TransferExpires int - HomeMapping string - EtagCacheTTL int + CommitShareToStorageGrant bool `yaml:"commit_share_to_storage_grant,omitempty"` + CommitShareToStorageRef bool `yaml:"commit_share_to_storage_ref,omitempty"` + ShareFolder string `yaml:"share_folder,omitempty"` + DisableHomeCreationOnLogin bool `yaml:"disable_home_creation_on_login,omitempty"` + TransferSecret string `yaml:"transfer_secret,omitempty" env:"STORAGE_TRANSFER_SECRET"` + TransferExpires int `yaml:"transfer_expires,omitempty"` + HomeMapping string `yaml:"home_mapping,omitempty"` + EtagCacheTTL int `yaml:"etag_cache_ttl,omitempty"` - UsersEndpoint string - GroupsEndpoint string - PermissionsEndpoint string - SharingEndpoint string - DataGatewayPublicURL string - FrontendPublicURL string `env:"OCIS_URL;GATEWAY_FRONTEND_PUBLIC_URL"` - AuthBasicEndpoint string - AuthBearerEndpoint string - AuthMachineEndpoint string - StoragePublicLinkEndpoint string - StorageUsersEndpoint string - StorageSharesEndpoint string + UsersEndpoint string `yaml:"users_endpoint,omitempty"` + GroupsEndpoint string `yaml:"groups_endpoint,omitempty"` + PermissionsEndpoint string `yaml:"permissions_endpoint,omitempty"` + SharingEndpoint string `yaml:"sharing_endpoint,omitempty"` + DataGatewayPublicURL string `yaml:"data_gateway_public_url,omitempty"` + FrontendPublicURL string `yaml:"frontend_public_url,omitempty" env:"OCIS_URL;GATEWAY_FRONTEND_PUBLIC_URL"` + AuthBasicEndpoint string `yaml:"auth_basic_endpoint,omitempty"` + AuthBearerEndpoint string `yaml:"auth_bearer_endpoint,omitempty"` + AuthMachineEndpoint string `yaml:"auth_machine_endpoint,omitempty"` + StoragePublicLinkEndpoint string `yaml:"storage_public_link_endpoint,omitempty"` + StorageUsersEndpoint string `yaml:"storage_users_endpoint,omitempty"` + StorageSharesEndpoint string `yaml:"storage_shares_endpoint,omitempty"` - StorageRegistry StorageRegistry - AppRegistry AppRegistry + StorageRegistry StorageRegistry `yaml:"storage_registry,omitempty"` + AppRegistry AppRegistry `yaml:"app_registry,omitempty"` } type Tracing struct { Enabled bool `yaml:"enabled" env:"OCIS_TRACING_ENABLED;GATEWAY_TRACING_ENABLED" desc:"Activates tracing."` diff --git a/extensions/group/pkg/config/config.go b/extensions/group/pkg/config/config.go index 9940bd7f2..1b8e0d632 100644 --- a/extensions/group/pkg/config/config.go +++ b/extensions/group/pkg/config/config.go @@ -5,19 +5,19 @@ import "github.com/owncloud/ocis/ocis-pkg/shared" type Config struct { *shared.Commons `yaml:"-"` Service Service `yaml:"-"` - Tracing *Tracing `yaml:"tracing"` - Logging *Logging `yaml:"log"` - Debug Debug `yaml:"debug"` - Supervised bool + Tracing *Tracing `yaml:"tracing,omitempty"` + Logging *Logging `yaml:"log,omitempty"` + Debug Debug `yaml:"debug,omitempty"` + Supervised bool `yaml:"supervised,omitempty"` - GRPC GRPCConfig `yaml:"grpc"` + GRPC GRPCConfig `yaml:"grpc,omitempty"` - JWTSecret string - GatewayEndpoint string - SkipUserGroupsInToken bool - GroupMembersCacheExpiration int - Driver string - Drivers Drivers + JWTSecret string `yaml:"jwt_secret,omitempty"` + GatewayEndpoint string `yaml:"gateway_endpoint,omitempty"` + SkipUserGroupsInToken bool `yaml:"skip_user_groups_in_token,omitempty"` + GroupMembersCacheExpiration int `yaml:"group_members_cache_expiration,omitempty"` + Driver string `yaml:"driver,omitempty"` + Drivers Drivers `yaml:"drivers,omitempty"` } type Tracing struct { Enabled bool `yaml:"enabled" env:"OCIS_TRACING_ENABLED;GROUPS_TRACING_ENABLED" desc:"Activates tracing."` diff --git a/extensions/ocdav/pkg/config/config.go b/extensions/ocdav/pkg/config/config.go index e81e6b628..efc048c86 100644 --- a/extensions/ocdav/pkg/config/config.go +++ b/extensions/ocdav/pkg/config/config.go @@ -5,29 +5,29 @@ import "github.com/owncloud/ocis/ocis-pkg/shared" type Config struct { *shared.Commons `yaml:"-"` Service Service `yaml:"-"` - Tracing *Tracing `yaml:"tracing"` - Logging *Logging `yaml:"log"` - Debug Debug `yaml:"debug"` - Supervised bool + Tracing *Tracing `yaml:"tracing,omitempty"` + Logging *Logging `yaml:"log,omitempty"` + Debug Debug `yaml:"debug,omitempty"` + Supervised bool `yaml:"supervised,omitempty"` - HTTP HTTPConfig `yaml:"http"` + HTTP HTTPConfig `yaml:"http,omitempty"` // JWTSecret used to verify reva access token JWTSecret string `yaml:"jwt_secret"` - GatewayEndpoint string - SkipUserGroupsInToken bool + GatewayEndpoint string `yaml:"gateway_endpoint,omitempty"` + SkipUserGroupsInToken bool `yaml:"skip_user_groups_in_token,omitempty"` - WebdavNamespace string `yaml:"webdav_namespace"` - FilesNamespace string `yaml:"files_namespace"` - SharesNamespace string `yaml:"shares_namespace"` + WebdavNamespace string `yaml:"webdav_namespace,omitempty"` + FilesNamespace string `yaml:"files_namespace,omitempty"` + SharesNamespace string `yaml:"shares_namespace,omitempty"` // PublicURL used to redirect /s/{token} URLs to - PublicURL string `yaml:"public_url" env:"OCIS_URL;OCDAV_PUBLIC_URL"` + PublicURL string `yaml:"public_url,omitempty" env:"OCIS_URL;OCDAV_PUBLIC_URL"` // Insecure certificates allowed when making requests to the gateway - Insecure bool `yaml:"insecure" env:"OCIS_INSECURE;OCDAV_INSECURE"` + Insecure bool `yaml:"insecure,omitempty" env:"OCIS_INSECURE;OCDAV_INSECURE"` // Timeout in seconds when making requests to the gateway - Timeout int64 `yaml:"timeout"` - Middleware Middleware + Timeout int64 `yaml:"timeout,omitempty"` + Middleware Middleware `yaml:"middleware,omitempty"` } type Tracing struct { Enabled bool `yaml:"enabled" env:"OCIS_TRACING_ENABLED;OCDAV_TRACING_ENABLED" desc:"Activates tracing."` @@ -62,10 +62,10 @@ type HTTPConfig struct { // Middleware configures reva middlewares. type Middleware struct { - Auth Auth `yaml:"auth"` + Auth Auth `yaml:"auth,omitempty"` } // Auth configures reva http auth middleware. type Auth struct { - CredentialsByUserAgent map[string]string `yaml:"credentials_by_user_agenr"` + CredentialsByUserAgent map[string]string `yaml:"credentials_by_user_agenr,omitempty"` } diff --git a/extensions/sharing/pkg/config/config.go b/extensions/sharing/pkg/config/config.go index 5302b788b..13e07c705 100644 --- a/extensions/sharing/pkg/config/config.go +++ b/extensions/sharing/pkg/config/config.go @@ -5,21 +5,21 @@ import "github.com/owncloud/ocis/ocis-pkg/shared" type Config struct { *shared.Commons `yaml:"-"` Service Service `yaml:"-"` - Tracing *Tracing `yaml:"tracing"` - Logging *Logging `yaml:"log"` - Debug Debug `yaml:"debug"` - Supervised bool + Tracing *Tracing `yaml:"tracing,omitempty"` + Logging *Logging `yaml:"log,omitempty"` + Debug Debug `yaml:"debug,omitempty"` + Supervised bool `yaml:"supervised,omitempty"` - GRPC GRPCConfig `yaml:"grpc"` + GRPC GRPCConfig `yaml:"grpc,omitempty"` - JWTSecret string - GatewayEndpoint string - SkipUserGroupsInToken bool - UserSharingDriver string - UserSharingDrivers UserSharingDrivers - PublicSharingDriver string - PublicSharingDrivers PublicSharingDrivers - Events Events + JWTSecret string `yaml:"jwt_secret,omitempty"` + GatewayEndpoint string `yaml:"gateway_endpoint,omitempty"` + SkipUserGroupsInToken bool `yaml:"skip_user_groups_in_token,omitempty"` + UserSharingDriver string `yaml:"user_sharing_driver,omitempty"` + UserSharingDrivers UserSharingDrivers `yaml:"user_sharin_drivers,omitempty"` + PublicSharingDriver string `yaml:"public_sharing_driver,omitempty"` + PublicSharingDrivers PublicSharingDrivers `yaml:"public_sharing_drivers,omitempty"` + Events Events `yaml:"events,omitempty"` } type Tracing struct { Enabled bool `yaml:"enabled" env:"OCIS_TRACING_ENABLED;SHARING_TRACING_ENABLED" desc:"Activates tracing."` diff --git a/extensions/storage-metadata/pkg/config/config.go b/extensions/storage-metadata/pkg/config/config.go index 526a4eabc..b9ea13eaf 100644 --- a/extensions/storage-metadata/pkg/config/config.go +++ b/extensions/storage-metadata/pkg/config/config.go @@ -9,23 +9,23 @@ import ( type Config struct { *shared.Commons `yaml:"-"` Service Service `yaml:"-"` - Tracing *Tracing `yaml:"tracing"` - Logging *Logging `yaml:"log"` - Debug Debug `yaml:"debug"` - Supervised bool + Tracing *Tracing `yaml:"tracing,omitempty"` + Logging *Logging `yaml:"log,omitempty"` + Debug Debug `yaml:"debug,omitempty"` + Supervised bool `yaml:"supervised,omitempty"` - GRPC GRPCConfig `yaml:"grpc"` - HTTP HTTPConfig `yaml:"http"` + GRPC GRPCConfig `yaml:"grpc,omitempty"` + HTTP HTTPConfig `yaml:"http,omitempty"` - Context context.Context - JWTSecret string - GatewayEndpoint string - SkipUserGroupsInToken bool - Driver string `yaml:"driver" env:"STORAGE_METADATA_DRIVER" desc:"The driver which should be used by the service"` - Drivers Drivers `yaml:"drivers"` - DataServerURL string - TempFolder string - DataProviderInsecure bool `env:"OCIS_INSECURE;STORAGE_METADATA_DATAPROVIDER_INSECURE"` + Context context.Context `yaml:"context,omitempty"` + JWTSecret string `yaml:"jwt_secret,omitempty"` + GatewayEndpoint string `yaml:"gateway_endpoint,omitempty"` + SkipUserGroupsInToken bool `yaml:"skip_user_groups_in_token,omitempty"` + Driver string `yaml:"driver,omitempty" env:"STORAGE_METADATA_DRIVER" desc:"The driver which should be used by the service"` + Drivers Drivers `yaml:"drivers,omitempty"` + DataServerURL string `yaml:"data_server_url,omitempty"` + TempFolder string `yaml:"temp_folder,omitempty"` + DataProviderInsecure bool `yaml:"data_providcer_insecure,omitempty" env:"OCIS_INSECURE;STORAGE_METADATA_DATAPROVIDER_INSECURE"` } type Tracing struct { Enabled bool `yaml:"enabled" env:"OCIS_TRACING_ENABLED;STORAGE_METADATA_TRACING_ENABLED" desc:"Activates tracing."` diff --git a/extensions/storage-publiclink/pkg/config/config.go b/extensions/storage-publiclink/pkg/config/config.go index 3766e35ea..aa19b583f 100644 --- a/extensions/storage-publiclink/pkg/config/config.go +++ b/extensions/storage-publiclink/pkg/config/config.go @@ -9,19 +9,19 @@ import ( type Config struct { *shared.Commons `yaml:"-"` Service Service `yaml:"-"` - Tracing *Tracing `yaml:"tracing"` - Logging *Logging `yaml:"log"` - Debug Debug `yaml:"debug"` - Supervised bool + Tracing *Tracing `yaml:"tracing,omitempty"` + Logging *Logging `yaml:"log,omitempty"` + Debug Debug `yaml:"debug,omitempty"` + Supervised bool `yaml:"supervised,omitempty"` - GRPC GRPCConfig `yaml:"grpc"` + GRPC GRPCConfig `yaml:"grpc,omitempty"` - Context context.Context - JWTSecret string - GatewayEndpoint string - SkipUserGroupsInToken bool - AuthProvider AuthProvider - StorageProvider StorageProvider + Context context.Context `yaml:"context,omitempty"` + JWTSecret string `yaml:"jwt_secret,omitempty"` + GatewayEndpoint string `yaml:"gateway_endpoint,omitempty"` + SkipUserGroupsInToken bool `yaml:"skip_user_groups_in_token,omitempty"` + AuthProvider AuthProvider `yaml:"auth_provider,omitempty"` + StorageProvider StorageProvider `yaml:"storage_provider,omitempty"` } type Tracing struct { Enabled bool `yaml:"enabled" env:"OCIS_TRACING_ENABLED;STORAGE_METADATA_TRACING_ENABLED" desc:"Activates tracing."` diff --git a/extensions/storage-shares/pkg/config/config.go b/extensions/storage-shares/pkg/config/config.go index 8c1345601..18c094c9f 100644 --- a/extensions/storage-shares/pkg/config/config.go +++ b/extensions/storage-shares/pkg/config/config.go @@ -9,20 +9,20 @@ import ( type Config struct { *shared.Commons `yaml:"-"` Service Service `yaml:"-"` - Tracing *Tracing `yaml:"tracing"` - Logging *Logging `yaml:"log"` - Debug Debug `yaml:"debug"` - Supervised bool + Tracing *Tracing `yaml:"tracing,omitempty"` + Logging *Logging `yaml:"log,omitempty"` + Debug Debug `yaml:"debug,omitempty"` + Supervised bool `yaml:"supervised,omitempty"` - GRPC GRPCConfig `yaml:"grpc"` - HTTP HTTPConfig `yaml:"http"` + GRPC GRPCConfig `yaml:"grpc,omitempty"` + HTTP HTTPConfig `yaml:"http,omitempty"` - Context context.Context - JWTSecret string - GatewayEndpoint string - SkipUserGroupsInToken bool - ReadOnly bool - SharesProviderEndpoint string + Context context.Context `yaml:"context,omitempty"` + JWTSecret string `yaml:"jwt_secret,omitempty"` + GatewayEndpoint string `yaml:"gateway_endpoint,omitempty"` + SkipUserGroupsInToken bool `yaml:"skip_user_groups_in_token,omitempty"` + ReadOnly bool `yaml:"readonly,omitempty"` + SharesProviderEndpoint string `yaml:"shares_provider_endpoint,omitempty"` } type Tracing struct { Enabled bool `yaml:"enabled" env:"OCIS_TRACING_ENABLED;STORAGE_METADATA_TRACING_ENABLED" desc:"Activates tracing."` diff --git a/extensions/storage-users/pkg/config/config.go b/extensions/storage-users/pkg/config/config.go index 1cbe61634..bc8cc30e4 100644 --- a/extensions/storage-users/pkg/config/config.go +++ b/extensions/storage-users/pkg/config/config.go @@ -9,27 +9,27 @@ import ( type Config struct { *shared.Commons `yaml:"-"` Service Service `yaml:"-"` - Tracing *Tracing `yaml:"tracing"` - Logging *Logging `yaml:"log"` - Debug Debug `yaml:"debug"` - Supervised bool + Tracing *Tracing `yaml:"tracing,omitempty"` + Logging *Logging `yaml:"log,omitempty"` + Debug Debug `yaml:"debug,omitempty"` + Supervised bool `yaml:"supervised,omitempty"` - GRPC GRPCConfig `yaml:"grpc"` - HTTP HTTPConfig `yaml:"http"` + GRPC GRPCConfig `yaml:"grpc,omitempty"` + HTTP HTTPConfig `yaml:"http,omitempty"` - Context context.Context - JWTSecret string - GatewayEndpoint string - SkipUserGroupsInToken bool - Driver string `yaml:"driver" env:"STORAGE_USERS_DRIVER" desc:"The storage driver which should be used by the service"` - Drivers Drivers `yaml:"drivers"` - DataServerURL string - TempFolder string - DataProviderInsecure bool `env:"OCIS_INSECURE;STORAGE_USERS_DATAPROVIDER_INSECURE"` - Events Events - MountID string - ExposeDataServer bool - ReadOnly bool + Context context.Context `yaml:"context,omitempty"` + JWTSecret string `yaml:"jwt_secret,omitempty"` + GatewayEndpoint string `yaml:"gateway_endpoint,omitempty"` + SkipUserGroupsInToken bool `yaml:"skip_user_groups_in_token,omitempty"` + Driver string `yaml:"driver,omitempty" env:"STORAGE_USERS_DRIVER" desc:"The storage driver which should be used by the service"` + Drivers Drivers `yaml:"drivers,omitempty"` + DataServerURL string `yaml:"data_server_url,omitempty"` + TempFolder string `yaml:"temp_folder,omitempty"` + DataProviderInsecure bool `yaml:"data_provider_insecure,omitempty" env:"OCIS_INSECURE;STORAGE_USERS_DATAPROVIDER_INSECURE"` + Events Events `yaml:"events,omitempty"` + MountID string `yaml:"mount_id,omitempty"` + ExposeDataServer bool `yaml:"expose_data_server,omitempty"` + ReadOnly bool `yaml:"readonly,omitempty"` } type Tracing struct { Enabled bool `yaml:"enabled" env:"OCIS_TRACING_ENABLED;STORAGE_USERS_TRACING_ENABLED" desc:"Activates tracing."` diff --git a/extensions/user/pkg/config/config.go b/extensions/user/pkg/config/config.go index efdcd5443..4c000da6c 100644 --- a/extensions/user/pkg/config/config.go +++ b/extensions/user/pkg/config/config.go @@ -5,19 +5,19 @@ import "github.com/owncloud/ocis/ocis-pkg/shared" type Config struct { *shared.Commons `yaml:"-"` Service Service `yaml:"-"` - Tracing *Tracing `yaml:"tracing"` - Logging *Logging `yaml:"log"` - Debug Debug `yaml:"debug"` - Supervised bool + Tracing *Tracing `yaml:"tracing,omitempty"` + Logging *Logging `yaml:"log,omitempty"` + Debug Debug `yaml:"debug,omitempty"` + Supervised bool `yaml:"supervised,omitempty"` - GRPC GRPCConfig `yaml:"grpc"` + GRPC GRPCConfig `yaml:"grpc,omitempty"` - JWTSecret string - GatewayEndpoint string - SkipUserGroupsInToken bool - UsersCacheExpiration int - Driver string - Drivers Drivers + JWTSecret string `yaml:"jwt_secret,omitempty"` + GatewayEndpoint string `yaml:"gateway_endpoint,omitempty"` + SkipUserGroupsInToken bool `yaml:"skip_user_groups_in_token,omitempty"` + UsersCacheExpiration int `yaml:"users_cache_expiration,omitempty"` + Driver string `yaml:"driver,omitempty"` + Drivers Drivers `yaml:"drivers,omitempty"` } type Tracing struct { Enabled bool `yaml:"enabled" env:"OCIS_TRACING_ENABLED;USERS_TRACING_ENABLED" desc:"Activates tracing."` diff --git a/ocis/pkg/command/init.go b/ocis/pkg/command/init.go index d92c038bd..e70129ca9 100644 --- a/ocis/pkg/command/init.go +++ b/ocis/pkg/command/init.go @@ -16,9 +16,21 @@ import ( cli "github.com/urfave/cli/v2" "gopkg.in/yaml.v3" + appprovider "github.com/owncloud/ocis/extensions/appprovider/pkg/config" + authbasic "github.com/owncloud/ocis/extensions/auth-basic/pkg/config" + authbearer "github.com/owncloud/ocis/extensions/auth-bearer/pkg/config" + authmachine "github.com/owncloud/ocis/extensions/auth-machine/pkg/config" + gateway "github.com/owncloud/ocis/extensions/gateway/pkg/config" + group "github.com/owncloud/ocis/extensions/group/pkg/config" idm "github.com/owncloud/ocis/extensions/idm/pkg/config" + ocdav "github.com/owncloud/ocis/extensions/ocdav/pkg/config" proxy "github.com/owncloud/ocis/extensions/proxy/pkg/config" - storage "github.com/owncloud/ocis/extensions/storage/pkg/config" + sharing "github.com/owncloud/ocis/extensions/sharing/pkg/config" + storagemetadata "github.com/owncloud/ocis/extensions/storage-metadata/pkg/config" + storagepublic "github.com/owncloud/ocis/extensions/storage-publiclink/pkg/config" + storageshares "github.com/owncloud/ocis/extensions/storage-shares/pkg/config" + storageusers "github.com/owncloud/ocis/extensions/storage-users/pkg/config" + user "github.com/owncloud/ocis/extensions/user/pkg/config" ) const configFilename string = "ocis.yaml" @@ -109,7 +121,20 @@ func createConfig(insecure, forceOverwrite bool, configPath string) error { //Proxy: &proxy.Config{}, //OCS: &ocs.Config{}, //Settings: &settings.Config{}, - Storage: &storage.Config{}, + // TODO: fix storage + AuthBasic: &authbasic.Config{}, + AuthBearer: &authbearer.Config{}, + AppProvider: &appprovider.Config{}, + AuthMachine: &authmachine.Config{}, + Gateway: &gateway.Config{}, + Group: &group.Config{}, + Sharing: &sharing.Config{}, + StorageMetadata: &storagemetadata.Config{}, + StorageUsers: &storageusers.Config{}, + StorageShares: &storageshares.Config{}, + StoragePublicLink: &storagepublic.Config{}, + User: &user.Config{}, + OCDav: &ocdav.Config{}, //Thumbnails: &thumbnails.Config{}, //Web: &web.Config{}, //WebDAV: &webdav.Config{}, @@ -172,8 +197,24 @@ func createConfig(insecure, forceOverwrite bool, configPath string) error { //cfg.Proxy.MachineAuthAPIKey = machineAuthSecret //cfg.Settings.Metadata.MachineAuthAPIKey = machineAuthSecret //cfg.Settings.TokenManager.JWTSecret = tokenManagerJwtSecret - cfg.Storage.Reva.JWTSecret = tokenManagerJwtSecret - cfg.Storage.OCDav.JWTSecret = tokenManagerJwtSecret + + //TODO: move all jwt secrets to shared.common + cfg.AppProvider.JWTSecret = tokenManagerJwtSecret + cfg.AuthBasic.JWTSecret = tokenManagerJwtSecret + cfg.AuthBearer.JWTSecret = tokenManagerJwtSecret + cfg.AuthMachine.JWTSecret = tokenManagerJwtSecret + cfg.Gateway.JWTSecret = tokenManagerJwtSecret + //TODO: following line is defunc, figure out why + //cfg.Gateway.MachineAuthAPIKey = machineAuthApiKey + cfg.Group.JWTSecret = tokenManagerJwtSecret + cfg.Sharing.JWTSecret = tokenManagerJwtSecret + cfg.StorageMetadata.JWTSecret = tokenManagerJwtSecret + cfg.StoragePublicLink.JWTSecret = tokenManagerJwtSecret + cfg.StorageShares.JWTSecret = tokenManagerJwtSecret + cfg.StorageUsers.JWTSecret = tokenManagerJwtSecret + cfg.User.JWTSecret = tokenManagerJwtSecret + cfg.OCDav.JWTSecret = tokenManagerJwtSecret + //cfg.Thumbnails.Thumbnail.TransferSecret = revaTransferTokenSecret yamlOutput, err := yaml.Marshal(cfg) if err != nil {