2022-03-28 08:05:09 +00:00
|
|
|
package start
|
|
|
|
|
|
|
|
import (
|
|
|
|
"github.com/spf13/cobra"
|
|
|
|
"github.com/spf13/viper"
|
2022-04-04 08:10:57 +00:00
|
|
|
|
2022-06-27 10:32:34 +00:00
|
|
|
"github.com/zitadel/zitadel/cmd/key"
|
|
|
|
"github.com/zitadel/zitadel/cmd/tls"
|
2022-03-28 08:05:09 +00:00
|
|
|
)
|
|
|
|
|
2022-06-24 12:38:22 +00:00
|
|
|
var tlsMode *string
|
|
|
|
|
2022-03-28 08:05:09 +00:00
|
|
|
func startFlags(cmd *cobra.Command) {
|
|
|
|
bindUint16Flag(cmd, "port", "port to run ZITADEL on")
|
|
|
|
bindStringFlag(cmd, "externalDomain", "domain ZITADEL will be exposed on")
|
|
|
|
bindStringFlag(cmd, "externalPort", "port ZITADEL will be exposed on")
|
|
|
|
|
2022-06-24 12:38:22 +00:00
|
|
|
tls.AddTLSModeFlag(cmd)
|
2022-04-04 08:10:57 +00:00
|
|
|
key.AddMasterKeyFlag(cmd)
|
2022-03-28 08:05:09 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func bindStringFlag(cmd *cobra.Command, name, description string) {
|
|
|
|
cmd.PersistentFlags().String(name, viper.GetString(name), description)
|
|
|
|
viper.BindPFlag(name, cmd.PersistentFlags().Lookup(name))
|
|
|
|
}
|
|
|
|
|
|
|
|
func bindUint16Flag(cmd *cobra.Command, name, description string) {
|
|
|
|
cmd.PersistentFlags().Uint16(name, uint16(viper.GetUint(name)), description)
|
|
|
|
viper.BindPFlag(name, cmd.PersistentFlags().Lookup(name))
|
|
|
|
}
|
|
|
|
|
|
|
|
func bindBoolFlag(cmd *cobra.Command, name, description string) {
|
|
|
|
cmd.PersistentFlags().Bool(name, viper.GetBool(name), description)
|
|
|
|
viper.BindPFlag(name, cmd.PersistentFlags().Lookup(name))
|
|
|
|
}
|