config
This commit is contained in:
14
cmd/root.go
14
cmd/root.go
@ -1,7 +1,3 @@
|
||||
/*
|
||||
Copyright © 2024 Darko Luketic <info@icod.de>
|
||||
|
||||
*/
|
||||
package cmd
|
||||
|
||||
import (
|
||||
@ -10,18 +6,10 @@ import (
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
|
||||
|
||||
// rootCmd represents the base command when called without any subcommands
|
||||
var rootCmd = &cobra.Command{
|
||||
Use: "accountserver",
|
||||
Short: "A brief description of your application",
|
||||
Long: `A longer description that spans multiple lines and likely contains
|
||||
examples and usage of using your application. For example:
|
||||
|
||||
Cobra is a CLI library for Go that empowers applications.
|
||||
This application is a tool to generate the needed files
|
||||
to quickly create a Cobra application.`,
|
||||
// Uncomment the following line if your bare application
|
||||
// has an action associated with it:
|
||||
// Run: func(cmd *cobra.Command, args []string) { },
|
||||
@ -47,5 +35,3 @@ func init() {
|
||||
// when this action is called directly.
|
||||
rootCmd.Flags().BoolP("toggle", "t", false, "Help message for toggle")
|
||||
}
|
||||
|
||||
|
||||
|
37
cmd/serve.go
Normal file
37
cmd/serve.go
Normal file
@ -0,0 +1,37 @@
|
||||
package cmd
|
||||
|
||||
import (
|
||||
"code.icod.de/auth/accountserver/configuration"
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
// serveCmd represents the serve command
|
||||
var serveCmd = &cobra.Command{
|
||||
Use: "serve",
|
||||
Short: "Run the account server",
|
||||
RunE: func(cmd *cobra.Command, args []string) error {
|
||||
return nil
|
||||
},
|
||||
}
|
||||
|
||||
func init() {
|
||||
rootCmd.AddCommand(serveCmd)
|
||||
|
||||
// Here you will define your flags and configuration settings.
|
||||
|
||||
serveCmd.Flags().BoolVar(&configuration.RunHTTP, "http", true, "Run http server")
|
||||
serveCmd.Flags().BoolVar(&configuration.RunGRPC, "grpc", true, "Run grpc server")
|
||||
|
||||
serveCmd.Flags().StringVar(&configuration.SMTPHost, "smtp-host", "localhost", "SMTP host")
|
||||
serveCmd.Flags().IntVar(&configuration.SMTPPort, "smtp-port", 587, "SMTP port")
|
||||
serveCmd.Flags().StringVar(&configuration.SMTPUser, "smtp-user", "", "SMTP user")
|
||||
serveCmd.Flags().StringVar(&configuration.SMTPPass, "smtp-pass", "", "SMTP password")
|
||||
|
||||
// Cobra supports Persistent Flags which will work for this command
|
||||
// and all subcommands, e.g.:
|
||||
// serveCmd.PersistentFlags().String("foo", "", "A help for foo")
|
||||
|
||||
// Cobra supports local flags which will only run when this command
|
||||
// is called directly, e.g.:
|
||||
// serveCmd.Flags().BoolP("toggle", "t", false, "Help message for toggle")
|
||||
}
|
Reference in New Issue
Block a user