mirror of
https://github.com/matrix-org/dendrite.git
synced 2026-01-06 21: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"
|
"strings"
|
||||||
|
|
||||||
"github.com/matrix-org/dendrite/setup"
|
"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/api"
|
||||||
"github.com/matrix-org/dendrite/userapi/storage"
|
"github.com/matrix-org/dendrite/userapi/storage"
|
||||||
"github.com/sirupsen/logrus"
|
"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(
|
accountDB, err := storage.NewUserAPIDatabase(
|
||||||
nil,
|
b,
|
||||||
&cfg.UserAPI.AccountDatabase,
|
&cfg.UserAPI.AccountDatabase,
|
||||||
cfg.Global.ServerName,
|
cfg.Global.ServerName,
|
||||||
cfg.UserAPI.BCryptCost,
|
cfg.UserAPI.BCryptCost,
|
||||||
|
|
|
||||||
|
|
@ -100,6 +100,7 @@ const (
|
||||||
DisableMetrics BaseDendriteOptions = iota
|
DisableMetrics BaseDendriteOptions = iota
|
||||||
UseHTTPAPIs
|
UseHTTPAPIs
|
||||||
PolylithMode
|
PolylithMode
|
||||||
|
CreateAccountMode
|
||||||
)
|
)
|
||||||
|
|
||||||
// NewBaseDendrite creates a new instance to be used by a component.
|
// 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
|
useHTTPAPIs := false
|
||||||
enableMetrics := true
|
enableMetrics := true
|
||||||
isMonolith := true
|
isMonolith := true
|
||||||
|
createAccountMode := false
|
||||||
for _, opt := range options {
|
for _, opt := range options {
|
||||||
switch opt {
|
switch opt {
|
||||||
case DisableMetrics:
|
case DisableMetrics:
|
||||||
|
|
@ -119,6 +121,9 @@ func NewBaseDendrite(cfg *config.Dendrite, componentName string, options ...Base
|
||||||
case PolylithMode:
|
case PolylithMode:
|
||||||
isMonolith = false
|
isMonolith = false
|
||||||
useHTTPAPIs = true
|
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())
|
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")
|
logrus.Warn("Open registration is enabled")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue