refactor: move intro function into server file
This commit is contained in:
@@ -18,8 +18,11 @@ package cmd
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
"fmt"
|
||||||
|
"github.com/common-nighthawk/go-figure"
|
||||||
"github.com/jkaninda/goma-gateway/internal/logger"
|
"github.com/jkaninda/goma-gateway/internal/logger"
|
||||||
"github.com/jkaninda/goma-gateway/pkg"
|
"github.com/jkaninda/goma-gateway/pkg"
|
||||||
|
"github.com/jkaninda/goma-gateway/util"
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -27,7 +30,7 @@ var ServerCmd = &cobra.Command{
|
|||||||
Use: "server",
|
Use: "server",
|
||||||
Short: "Start server",
|
Short: "Start server",
|
||||||
Run: func(cmd *cobra.Command, args []string) {
|
Run: func(cmd *cobra.Command, args []string) {
|
||||||
pkg.Intro()
|
intro()
|
||||||
configFile, _ := cmd.Flags().GetString("config")
|
configFile, _ := cmd.Flags().GetString("config")
|
||||||
if configFile == "" {
|
if configFile == "" {
|
||||||
configFile = pkg.GetConfigPaths()
|
configFile = pkg.GetConfigPaths()
|
||||||
@@ -49,3 +52,10 @@ var ServerCmd = &cobra.Command{
|
|||||||
func init() {
|
func init() {
|
||||||
ServerCmd.Flags().StringP("config", "", "", "Goma config file")
|
ServerCmd.Flags().StringP("config", "", "", "Goma config file")
|
||||||
}
|
}
|
||||||
|
func intro() {
|
||||||
|
nameFigure := figure.NewFigure("Goma", "", true)
|
||||||
|
nameFigure.Print()
|
||||||
|
fmt.Printf("Version: %s\n", util.FullVersion())
|
||||||
|
fmt.Println("Copyright (c) 2024 Jonas Kaninda")
|
||||||
|
fmt.Println("Starting Goma Gateway server...")
|
||||||
|
}
|
||||||
|
|||||||
@@ -11,19 +11,10 @@ You may get a copy of the License at
|
|||||||
*/
|
*/
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/common-nighthawk/go-figure"
|
|
||||||
"github.com/jedib0t/go-pretty/v6/table"
|
"github.com/jedib0t/go-pretty/v6/table"
|
||||||
"github.com/jkaninda/goma-gateway/util"
|
|
||||||
"net/http"
|
"net/http"
|
||||||
)
|
)
|
||||||
|
|
||||||
func Intro() {
|
|
||||||
nameFigure := figure.NewFigure("Goma", "", true)
|
|
||||||
nameFigure.Print()
|
|
||||||
fmt.Printf("Version: %s\n", util.FullVersion())
|
|
||||||
fmt.Println("Copyright (c) 2024 Jonas Kaninda")
|
|
||||||
fmt.Println("Starting Goma Gateway server...")
|
|
||||||
}
|
|
||||||
func printRoute(routes []Route) {
|
func printRoute(routes []Route) {
|
||||||
t := table.NewWriter()
|
t := table.NewWriter()
|
||||||
t.AppendHeader(table.Row{"Name", "Route", "Rewrite", "Destination"})
|
t.AppendHeader(table.Row{"Name", "Route", "Rewrite", "Destination"})
|
||||||
|
|||||||
Reference in New Issue
Block a user