mirror of
https://github.com/opencloud-eu/opencloud.git
synced 2026-05-06 11:31:00 -05:00
Public share SQL driver config
This commit is contained in:
@@ -85,6 +85,7 @@ func (c *cs3backend) GetUserByClaims(ctx context.Context, claim, value string, w
|
||||
|
||||
func (c *cs3backend) Authenticate(ctx context.Context, username string, password string) (*cs3.User, error) {
|
||||
res, err := c.authProvider.Authenticate(ctx, &gateway.AuthenticateRequest{
|
||||
Type: "basic",
|
||||
ClientId: username,
|
||||
ClientSecret: password,
|
||||
})
|
||||
|
||||
@@ -140,6 +140,16 @@ func sharingConfigFromStruct(c *cli.Context, cfg *config.Config) map[string]inte
|
||||
"json": map[string]interface{}{
|
||||
"file": cfg.Reva.Sharing.PublicJSONFile,
|
||||
},
|
||||
"sql": map[string]interface{}{
|
||||
"db_username": cfg.Reva.Sharing.UserSQLUsername,
|
||||
"db_password": cfg.Reva.Sharing.UserSQLPassword,
|
||||
"db_host": cfg.Reva.Sharing.UserSQLHost,
|
||||
"db_port": cfg.Reva.Sharing.UserSQLPort,
|
||||
"db_name": cfg.Reva.Sharing.UserSQLName,
|
||||
"password_hash_cost": cfg.Reva.Sharing.PublicPasswordHashCost,
|
||||
"enable_expired_shares_cleanup": cfg.Reva.Sharing.PublicEnableExpiredSharesCleanup,
|
||||
"janitor_run_interval": cfg.Reva.Sharing.PublicJanitorRunInterval,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
@@ -41,15 +41,18 @@ type StorageRegistry struct {
|
||||
// Sharing defines the available sharing configuration.
|
||||
type Sharing struct {
|
||||
Port
|
||||
UserDriver string
|
||||
UserJSONFile string
|
||||
UserSQLUsername string
|
||||
UserSQLPassword string
|
||||
UserSQLHost string
|
||||
UserSQLPort int
|
||||
UserSQLName string
|
||||
PublicDriver string
|
||||
PublicJSONFile string
|
||||
UserDriver string
|
||||
UserJSONFile string
|
||||
UserSQLUsername string
|
||||
UserSQLPassword string
|
||||
UserSQLHost string
|
||||
UserSQLPort int
|
||||
UserSQLName string
|
||||
PublicDriver string
|
||||
PublicJSONFile string
|
||||
PublicPasswordHashCost int
|
||||
PublicEnableExpiredSharesCleanup bool
|
||||
PublicJanitorRunInterval int
|
||||
}
|
||||
|
||||
// Port defines the available port configuration.
|
||||
|
||||
@@ -71,6 +71,27 @@ func SharingWithConfig(cfg *config.Config) []cli.Flag {
|
||||
EnvVars: []string{"STORAGE_SHARING_PUBLIC_JSON_FILE"},
|
||||
Destination: &cfg.Reva.Sharing.PublicJSONFile,
|
||||
},
|
||||
&cli.IntFlag{
|
||||
Name: "public-password-hash-cost",
|
||||
Value: flags.OverrideDefaultInt(cfg.Reva.Sharing.PublicPasswordHashCost, 11),
|
||||
Usage: "the cost of hashing the public shares passwords",
|
||||
EnvVars: []string{"STORAGE_SHARING_PUBLIC_PASSWORD_HASH_COST"},
|
||||
Destination: &cfg.Reva.Sharing.PublicPasswordHashCost,
|
||||
},
|
||||
&cli.BoolFlag{
|
||||
Name: "public-enable-expired-shares-cleanup",
|
||||
Value: flags.OverrideDefaultBool(cfg.Reva.Sharing.PublicEnableExpiredSharesCleanup, true),
|
||||
Usage: "whether to periodically delete expired public shares",
|
||||
EnvVars: []string{"STORAGE_SHARING_PUBLIC_ENABLE_EXPIRED_SHARES_CLEANUP"},
|
||||
Destination: &cfg.Reva.Sharing.PublicEnableExpiredSharesCleanup,
|
||||
},
|
||||
&cli.IntFlag{
|
||||
Name: "public-janitor-run-interval",
|
||||
Value: flags.OverrideDefaultInt(cfg.Reva.Sharing.PublicJanitorRunInterval, 60),
|
||||
Usage: "the time period in seconds after which to start a janitor run",
|
||||
EnvVars: []string{"STORAGE_SHARING_PUBLIC_JANITOR_RUN_INTERVAL"},
|
||||
Destination: &cfg.Reva.Sharing.PublicJanitorRunInterval,
|
||||
},
|
||||
}
|
||||
|
||||
flags = append(flags, TracingWithConfig(cfg)...)
|
||||
|
||||
@@ -41,7 +41,7 @@ func SharingSQLWithConfig(cfg *config.Config) []cli.Flag {
|
||||
Name: "user-sql-name",
|
||||
Value: flags.OverrideDefaultString(cfg.Reva.Sharing.UserSQLName, ""),
|
||||
Usage: "Name of the SQL database",
|
||||
EnvVars: []string{"STORAGE_SHARING_USER_SQL_Name"},
|
||||
EnvVars: []string{"STORAGE_SHARING_USER_SQL_NAME"},
|
||||
Destination: &cfg.Reva.Sharing.UserSQLName,
|
||||
},
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user