mirror of
https://github.com/matrix-org/dendrite.git
synced 2026-01-04 20:53:09 -06:00
Fix create-account with global database settings
This commit is contained in:
parent
58af7f61b6
commit
9722df46f8
|
|
@ -25,6 +25,7 @@ import (
|
|||
"strings"
|
||||
|
||||
"github.com/matrix-org/dendrite/setup"
|
||||
"github.com/matrix-org/dendrite/setup/base"
|
||||
"github.com/matrix-org/dendrite/userapi/api"
|
||||
"github.com/matrix-org/dendrite/userapi/storage"
|
||||
"github.com/sirupsen/logrus"
|
||||
|
|
@ -99,8 +100,11 @@ func main() {
|
|||
}
|
||||
}
|
||||
|
||||
b := base.NewBaseDendrite(cfg, "", base.CreateAccountMode)
|
||||
defer b.Close() // nolint: errcheck
|
||||
|
||||
accountDB, err := storage.NewUserAPIDatabase(
|
||||
nil,
|
||||
b,
|
||||
&cfg.UserAPI.AccountDatabase,
|
||||
cfg.Global.ServerName,
|
||||
cfg.UserAPI.BCryptCost,
|
||||
|
|
|
|||
|
|
@ -100,6 +100,7 @@ const (
|
|||
DisableMetrics BaseDendriteOptions = iota
|
||||
UseHTTPAPIs
|
||||
PolylithMode
|
||||
CreateAccountMode
|
||||
)
|
||||
|
||||
// NewBaseDendrite creates a new instance to be used by a component.
|
||||
|
|
@ -110,6 +111,7 @@ func NewBaseDendrite(cfg *config.Dendrite, componentName string, options ...Base
|
|||
useHTTPAPIs := false
|
||||
enableMetrics := true
|
||||
isMonolith := true
|
||||
createAccountMode := false
|
||||
for _, opt := range options {
|
||||
switch opt {
|
||||
case DisableMetrics:
|
||||
|
|
@ -119,6 +121,9 @@ func NewBaseDendrite(cfg *config.Dendrite, componentName string, options ...Base
|
|||
case PolylithMode:
|
||||
isMonolith = false
|
||||
useHTTPAPIs = true
|
||||
case CreateAccountMode:
|
||||
createAccountMode = true
|
||||
cfg.ClientAPI.OpenRegistrationWithoutVerificationEnabled = true
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -137,7 +142,7 @@ func NewBaseDendrite(cfg *config.Dendrite, componentName string, options ...Base
|
|||
|
||||
logrus.Infof("Dendrite version %s", internal.VersionString())
|
||||
|
||||
if !cfg.ClientAPI.RegistrationDisabled && cfg.ClientAPI.OpenRegistrationWithoutVerificationEnabled {
|
||||
if !createAccountMode && !cfg.ClientAPI.RegistrationDisabled && cfg.ClientAPI.OpenRegistrationWithoutVerificationEnabled {
|
||||
logrus.Warn("Open registration is enabled")
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue