BREAKING CHANGE: The original Go module name was `github.com/ArtalkJS/Artalk`, which has now been modified to `github.com/artalkjs/artalk/v2` (all lowercase). This change may affect the CI pipeline or other areas if you are compiling the Artalk server and have specified the fixed Go module name. Regarding the original `-ldflags -X github.com/ArtalkJS/Artalk/internal/config.Version` and `CommitHash` definitions, please remove them, as they are now obsolete. The `Version` has been hardcoded into the Go code, and the `CommitHash` is now read from the Go build info via runtime/debug’s vcs.revision value. This change only affects the server developers and does not impact the frontend UI client.
36 lines
729 B
Go
36 lines
729 B
Go
package cmd
|
|
|
|
import (
|
|
"fmt"
|
|
|
|
"github.com/artalkjs/artalk/v2/internal/log"
|
|
"github.com/artalkjs/artalk/v2/server"
|
|
|
|
"github.com/spf13/cobra"
|
|
)
|
|
|
|
func NewServeCommand(app *ArtalkCmd) *cobra.Command {
|
|
var serverCmd = &cobra.Command{
|
|
Use: "server",
|
|
Aliases: []string{"serve"},
|
|
Short: "Start the server",
|
|
Long: Banner,
|
|
Args: cobra.NoArgs,
|
|
Run: func(cmd *cobra.Command, args []string) {
|
|
fmt.Println(Banner)
|
|
fmt.Print("-------------------------------\n\n")
|
|
|
|
// init fiber app
|
|
_, err := server.Serve(app.App)
|
|
if err != nil {
|
|
log.Fatalln(err)
|
|
}
|
|
},
|
|
}
|
|
|
|
flagPV(serverCmd, "host", "", "0.0.0.0", "Listening IP")
|
|
flagPV(serverCmd, "port", "", 23366, "Listening port")
|
|
|
|
return serverCmd
|
|
}
|