storagenode: allow configuring database path independently

Fixes #3852

Change-Id: I021c29c4dd7c393399f6abef41d8457514032833
This commit is contained in:
Jeff Wendling 2020-04-30 16:08:32 -06:00 committed by Egon Elbre
parent c630cf2490
commit 57eb8a17e2
2 changed files with 7 additions and 2 deletions

View File

@ -125,10 +125,14 @@ type Config struct {
// DatabaseConfig returns the storagenodedb.Config that should be used with this Config.
func (config *Config) DatabaseConfig() storagenodedb.Config {
dbdir := config.Storage2.DatabaseDir
if dbdir == "" {
dbdir = config.Storage.Path
}
return storagenodedb.Config{
Storage: config.Storage.Path,
Info: filepath.Join(config.Storage.Path, "piecestore.db"),
Info2: filepath.Join(config.Storage.Path, "info.db"),
Info: filepath.Join(dbdir, "piecestore.db"),
Info2: filepath.Join(dbdir, "info.db"),
Pieces: config.Storage.Path,
Filestore: config.Filestore,
}

View File

@ -53,6 +53,7 @@ type OldConfig struct {
// Config defines parameters for piecestore endpoint.
type Config struct {
DatabaseDir string `help:"directory to store databases. if empty, uses data path" default:""`
ExpirationGracePeriod time.Duration `help:"how soon before expiration date should things be considered expired" default:"48h0m0s"`
MaxConcurrentRequests int `help:"how many concurrent requests are allowed, before uploads are rejected. 0 represents unlimited." default:"0"`
DeleteWorkers int `help:"how many piece delete workers" default:"0"`