Added start of Muldap web service
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
This commit is contained in:
@ -10,6 +10,7 @@ import (
|
||||
"git.metaunix.net/metaunix.net/muldap/cmd/group"
|
||||
"git.metaunix.net/metaunix.net/muldap/cmd/ldif"
|
||||
"git.metaunix.net/metaunix.net/muldap/cmd/user"
|
||||
"git.metaunix.net/metaunix.net/muldap/cmd/web"
|
||||
)
|
||||
|
||||
func init() {
|
||||
@ -21,7 +22,7 @@ func init() {
|
||||
viper.BindPFlag("port", rootCmd.PersistentFlags().Lookup("port"))
|
||||
|
||||
// register commands
|
||||
rootCmd.AddCommand(group.GroupCmd, ldif.LdifCmd, user.UserCmd, searchCmd, setupCmd, versionCmd)
|
||||
rootCmd.AddCommand(group.GroupCmd, ldif.LdifCmd, user.UserCmd, web.WebCmd, searchCmd, setupCmd, versionCmd)
|
||||
}
|
||||
|
||||
// define root command
|
||||
|
33
cmd/web/init.go
Normal file
33
cmd/web/init.go
Normal file
@ -0,0 +1,33 @@
|
||||
package web
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/flamego/flamego"
|
||||
"github.com/flamego/template"
|
||||
"github.com/spf13/cobra"
|
||||
|
||||
w "git.metaunix.net/metaunix.net/muldap/lib/web"
|
||||
)
|
||||
|
||||
// define web command
|
||||
var WebCmd = &cobra.Command{
|
||||
Use: "web",
|
||||
Short: "Start the web service.",
|
||||
Long: `Start the Muldap web service.`,
|
||||
Run: func(cmd *cobra.Command, args []string) {
|
||||
fmt.Println("Starting the Muldap web server...")
|
||||
|
||||
// instantiate Flamego server instance
|
||||
f := flamego.Classic()
|
||||
|
||||
// enable templates
|
||||
f.Use(template.Templater())
|
||||
|
||||
// register routes
|
||||
w.RegisterRoutes(f)
|
||||
|
||||
// start Flamego
|
||||
f.Run()
|
||||
},
|
||||
}
|
Reference in New Issue
Block a user