mirror of
https://github.com/zitadel/zitadel.git
synced 2024-12-12 19:14:23 +00:00
c2cb84cd24
* backup new protoc plugin * backup * session * backup * initial implementation * change to specific events * implement tests * cleanup * refactor: use new protoc plugin for api v2 * change package * simplify code * cleanup * cleanup * fix merge * start queries * fix tests * improve returned values * add token to projection * tests * test db map * update query * permission checks * fix tests and linting * rework token creation * i18n * refactor token check and fix tests * session to PB test * request to query tests * cleanup proto * test user check * add comment * simplify database map type * Update docs/docs/guides/integrate/access-zitadel-system-api.md Co-authored-by: Tim Möhlmann <tim+github@zitadel.com> * fix test * cleanup * docs --------- Co-authored-by: Tim Möhlmann <tim+github@zitadel.com>
67 lines
1.5 KiB
Go
67 lines
1.5 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
|
|
}
|
|
|
|
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,
|
|
systemdefaults.SystemDefaults{},
|
|
nil,
|
|
nil,
|
|
nil,
|
|
mig.ExternalDomain,
|
|
mig.ExternalSecure,
|
|
mig.ExternalPort,
|
|
nil,
|
|
nil,
|
|
nil,
|
|
nil,
|
|
nil,
|
|
nil,
|
|
nil,
|
|
nil,
|
|
nil,
|
|
nil,
|
|
nil,
|
|
)
|
|
|
|
if err != nil {
|
|
return err
|
|
}
|
|
return cmd.ChangeSystemConfig(ctx, mig.currentExternalDomain, mig.currentExternalPort, mig.currentExternalSecure)
|
|
}
|
|
|
|
func (mig *externalConfigChange) String() string {
|
|
return "config_change"
|
|
}
|