mirror of
https://github.com/zitadel/zitadel.git
synced 2024-12-12 02:54:20 +00:00
4589ddad4a
* feat: use passwap for human user passwords * fix tests * passwap config * add the event mapper * cleanup query side and api * solve linting errors * regression test * try to fix linter errors again * pass systemdefaults into externalConfigChange migration * fix: user password set in auth view * pin passwap v0.2.0 * v2: validate hashed password hash based on prefix * resolve remaining comments * add error tag and translation for unsupported hash encoding * fix unit test --------- Co-authored-by: Livio Spring <livio.a@gmail.com>
71 lines
1.6 KiB
Go
71 lines
1.6 KiB
Go
package setup
|
|
|
|
import (
|
|
"context"
|
|
|
|
"github.com/zitadel/zitadel/internal/command"
|
|
"github.com/zitadel/zitadel/internal/config/systemdefaults"
|
|
"github.com/zitadel/zitadel/internal/eventstore"
|
|
)
|
|
|
|
type externalConfigChange struct {
|
|
es *eventstore.Eventstore
|
|
ExternalDomain string `json:"externalDomain"`
|
|
ExternalSecure bool `json:"externalSecure"`
|
|
ExternalPort uint16 `json:"externalPort"`
|
|
|
|
currentExternalDomain string
|
|
currentExternalSecure bool
|
|
currentExternalPort uint16
|
|
defaults systemdefaults.SystemDefaults
|
|
}
|
|
|
|
func (mig *externalConfigChange) SetLastExecution(lastRun map[string]interface{}) {
|
|
mig.currentExternalDomain, _ = lastRun["externalDomain"].(string)
|
|
externalPort, _ := lastRun["externalPort"].(float64)
|
|
mig.currentExternalPort = uint16(externalPort)
|
|
mig.currentExternalSecure, _ = lastRun["externalSecure"].(bool)
|
|
}
|
|
|
|
func (mig *externalConfigChange) Check() bool {
|
|
return mig.currentExternalSecure != mig.ExternalSecure ||
|
|
mig.currentExternalPort != mig.ExternalPort ||
|
|
mig.currentExternalDomain != mig.ExternalDomain
|
|
}
|
|
|
|
func (mig *externalConfigChange) Execute(ctx context.Context) error {
|
|
cmd, err := command.StartCommands(
|
|
mig.es,
|
|
mig.defaults,
|
|
nil,
|
|
nil,
|
|
nil,
|
|
mig.ExternalDomain,
|
|
mig.ExternalSecure,
|
|
mig.ExternalPort,
|
|
nil,
|
|
nil,
|
|
nil,
|
|
nil,
|
|
nil,
|
|
nil,
|
|
nil,
|
|
nil,
|
|
nil,
|
|
nil,
|
|
nil,
|
|
0,
|
|
0,
|
|
0,
|
|
)
|
|
|
|
if err != nil {
|
|
return err
|
|
}
|
|
return cmd.ChangeSystemConfig(ctx, mig.currentExternalDomain, mig.currentExternalPort, mig.currentExternalSecure)
|
|
}
|
|
|
|
func (mig *externalConfigChange) String() string {
|
|
return "config_change"
|
|
}
|