From f7c7e2951d0361309f62c322883a9028bbf0b29e Mon Sep 17 00:00:00 2001 From: Nicola Murino Date: Sun, 21 Mar 2021 19:58:57 +0100 Subject: [PATCH] initialize argon params before creating the data provider Fixes #349 --- dataprovider/dataprovider.go | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/dataprovider/dataprovider.go b/dataprovider/dataprovider.go index 31fe525d..a8c8b6f9 100644 --- a/dataprovider/dataprovider.go +++ b/dataprovider/dataprovider.go @@ -427,6 +427,13 @@ func Initialize(cnf Config, basePath string, checkAdmins bool) error { credentialsDirPath = filepath.Join(basePath, config.CredentialsPath) } vfs.SetCredentialsDirPath(credentialsDirPath) + argon2Params = &argon2id.Params{ + Memory: cnf.PasswordHashing.Argon2Options.Memory, + Iterations: cnf.PasswordHashing.Argon2Options.Iterations, + Parallelism: cnf.PasswordHashing.Argon2Options.Parallelism, + SaltLength: 16, + KeyLength: 32, + } if err = validateHooks(); err != nil { return err @@ -435,13 +442,6 @@ func Initialize(cnf Config, basePath string, checkAdmins bool) error { if err != nil { return err } - argon2Params = &argon2id.Params{ - Memory: cnf.PasswordHashing.Argon2Options.Memory, - Iterations: cnf.PasswordHashing.Argon2Options.Iterations, - Parallelism: cnf.PasswordHashing.Argon2Options.Parallelism, - SaltLength: 16, - KeyLength: 32, - } if cnf.UpdateMode == 0 { err = provider.initializeDatabase() if err != nil && err != ErrNoInitRequired {