2023-06-24 18:40:57 +00:00
|
|
|
package cmd
|
|
|
|
|
|
|
|
import (
|
|
|
|
"github.com/spf13/cobra"
|
|
|
|
|
2023-08-27 11:52:32 +00:00
|
|
|
"codeberg.org/aryak/mozhi/serve"
|
2023-06-24 18:40:57 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
var port string = "3000"
|
|
|
|
|
|
|
|
var serveCmd = &cobra.Command{
|
|
|
|
Use: "serve",
|
|
|
|
Short: "Start the web server.",
|
|
|
|
Long: `Start the web server.`,
|
|
|
|
Run: func(cmd *cobra.Command, args []string) {
|
|
|
|
serve.Serve(port)
|
|
|
|
},
|
|
|
|
}
|
|
|
|
|
|
|
|
func init() {
|
|
|
|
rootCmd.AddCommand(serveCmd)
|
|
|
|
|
2023-08-27 11:52:32 +00:00
|
|
|
serveCmd.Flags().StringVarP(&port, "port", "p", "", "The port Mozhi will listen to. Defaults to 3000, and overrides the MOZHI_PORT environment variable.")
|
2023-06-24 18:40:57 +00:00
|
|
|
|
|
|
|
// set port variable to the value of the port flag
|
|
|
|
port = serveCmd.Flag("port").Value.String()
|
|
|
|
}
|