mirror of
https://github.com/zitadel/zitadel.git
synced 2024-12-12 11:04:25 +00:00
41 lines
1.0 KiB
Go
41 lines
1.0 KiB
Go
|
package start
|
||
|
|
||
|
import (
|
||
|
"github.com/caos/logging"
|
||
|
"github.com/caos/zitadel/cmd/admin/initialise"
|
||
|
"github.com/caos/zitadel/cmd/admin/setup"
|
||
|
"github.com/spf13/cobra"
|
||
|
"github.com/spf13/viper"
|
||
|
)
|
||
|
|
||
|
func NewStartFromInit() *cobra.Command {
|
||
|
cmd := &cobra.Command{
|
||
|
Use: "start-from-init",
|
||
|
Short: "cold starts zitadel",
|
||
|
Long: `cold starts ZITADEL.
|
||
|
First the minimum requirements to start ZITADEL are set up.
|
||
|
Second the initial events are created.
|
||
|
Last ZITADEL starts.
|
||
|
|
||
|
Requirements:
|
||
|
- cockroachdb`,
|
||
|
Run: func(cmd *cobra.Command, args []string) {
|
||
|
initialise.InitAll(initialise.MustNewConfig(viper.GetViper()))
|
||
|
|
||
|
setupConfig := setup.MustNewConfig(viper.GetViper())
|
||
|
setupSteps := setup.MustNewSteps(viper.New())
|
||
|
setup.Setup(setupConfig, setupSteps)
|
||
|
|
||
|
startConfig := MustNewConfig(viper.GetViper())
|
||
|
startMasterKey, _ := cmd.Flags().GetString(flagMasterKey)
|
||
|
|
||
|
err := startZitadel(startConfig, startMasterKey)
|
||
|
logging.OnError(err).Fatal("unable to start zitadel")
|
||
|
},
|
||
|
}
|
||
|
|
||
|
startFlags(cmd)
|
||
|
|
||
|
return cmd
|
||
|
}
|