mirror of
https://github.com/zitadel/zitadel.git
synced 2025-02-28 23:17:23 +00:00
fix: SMTP config in defaults (#3736)
* fix(command): create smtp provider cmds after domains * chore(defaults): add smtp configuration
This commit is contained in:
parent
e897422541
commit
3513148cf6
File diff suppressed because one or more lines are too long
@ -270,20 +270,6 @@ func (c *Commands) SetUpInstance(ctx context.Context, setup *InstanceSetup) (str
|
|||||||
ClockSkew: 0,
|
ClockSkew: 0,
|
||||||
}
|
}
|
||||||
|
|
||||||
if setup.SMTPConfiguration != nil {
|
|
||||||
validations = append(validations,
|
|
||||||
c.prepareAddSMTPConfig(
|
|
||||||
instanceAgg,
|
|
||||||
setup.SMTPConfiguration.From,
|
|
||||||
setup.SMTPConfiguration.FromName,
|
|
||||||
setup.SMTPConfiguration.SMTP.Host,
|
|
||||||
setup.SMTPConfiguration.SMTP.User,
|
|
||||||
[]byte(setup.SMTPConfiguration.SMTP.Password),
|
|
||||||
setup.SMTPConfiguration.Tls,
|
|
||||||
),
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
validations = append(validations,
|
validations = append(validations,
|
||||||
AddOrgCommand(ctx, orgAgg, setup.Org.Name),
|
AddOrgCommand(ctx, orgAgg, setup.Org.Name),
|
||||||
AddHumanCommand(userAgg, &setup.Org.Human, c.userPasswordAlg, c.userEncryption),
|
AddHumanCommand(userAgg, &setup.Org.Human, c.userPasswordAlg, c.userEncryption),
|
||||||
@ -332,11 +318,12 @@ func (c *Commands) SetUpInstance(ctx context.Context, setup *InstanceSetup) (str
|
|||||||
c.AddOIDCAppCommand(console, nil),
|
c.AddOIDCAppCommand(console, nil),
|
||||||
SetIAMConsoleID(instanceAgg, &console.ClientID, &setup.zitadel.consoleAppID),
|
SetIAMConsoleID(instanceAgg, &console.ClientID, &setup.zitadel.consoleAppID),
|
||||||
)
|
)
|
||||||
addGenerateddDomain, err := c.addGeneratedInstanceDomain(ctx, instanceAgg, setup.InstanceName)
|
|
||||||
|
addGeneratedDomain, err := c.addGeneratedInstanceDomain(ctx, instanceAgg, setup.InstanceName)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", nil, err
|
return "", nil, err
|
||||||
}
|
}
|
||||||
validations = append(validations, addGenerateddDomain...)
|
validations = append(validations, addGeneratedDomain...)
|
||||||
if setup.CustomDomain != "" {
|
if setup.CustomDomain != "" {
|
||||||
validations = append(validations,
|
validations = append(validations,
|
||||||
c.addInstanceDomain(instanceAgg, setup.CustomDomain, false),
|
c.addInstanceDomain(instanceAgg, setup.CustomDomain, false),
|
||||||
@ -344,6 +331,20 @@ func (c *Commands) SetUpInstance(ctx context.Context, setup *InstanceSetup) (str
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if setup.SMTPConfiguration != nil {
|
||||||
|
validations = append(validations,
|
||||||
|
c.prepareAddSMTPConfig(
|
||||||
|
instanceAgg,
|
||||||
|
setup.SMTPConfiguration.From,
|
||||||
|
setup.SMTPConfiguration.FromName,
|
||||||
|
setup.SMTPConfiguration.SMTP.Host,
|
||||||
|
setup.SMTPConfiguration.SMTP.User,
|
||||||
|
[]byte(setup.SMTPConfiguration.SMTP.Password),
|
||||||
|
setup.SMTPConfiguration.Tls,
|
||||||
|
),
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
cmds, err := preparation.PrepareCommands(ctx, c.eventstore.Filter, validations...)
|
cmds, err := preparation.PrepareCommands(ctx, c.eventstore.Filter, validations...)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", nil, err
|
return "", nil, err
|
||||||
|
@ -158,6 +158,9 @@ func (c *Commands) prepareChangeSMTPConfig(a *instance.Aggregate, from, name, ho
|
|||||||
host,
|
host,
|
||||||
user,
|
user,
|
||||||
)
|
)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
if !hasChanged {
|
if !hasChanged {
|
||||||
return nil, caos_errs.ThrowPreconditionFailed(nil, "COMMAND-m0o3f", "Errors.NoChangesFound")
|
return nil, caos_errs.ThrowPreconditionFailed(nil, "COMMAND-m0o3f", "Errors.NoChangesFound")
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user