From 2bb34800c7df5e169444e50117e7bc3022aae15a Mon Sep 17 00:00:00 2001 From: Leon Date: Tue, 20 Feb 2024 19:56:18 +0800 Subject: [PATCH] Refactor server start output and add network IP addresses --- .github/workflows/release.yml | 1 + cmd/main.go | 12 ++++++------ 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index ce8a58f..8e7702e 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -57,6 +57,7 @@ jobs: uses: actions/checkout@v4 with: ref: ${{ needs.setup.outputs.TAG_NAME }} + - name: Download artifacts uses: actions/download-artifact@v4 diff --git a/cmd/main.go b/cmd/main.go index d4da777..0066640 100644 --- a/cmd/main.go +++ b/cmd/main.go @@ -53,23 +53,23 @@ func main() { srv := controller.ServerWeb(port) startOutput := func() { + + fmt.Println() + fmt.Println("Server available routes:") + mygin.PrintRoute(srv.Handler.(*gin.Engine)) + fmt.Println() fmt.Println("Server is running with config:") utils.PrintStructFieldsAndValues(singleton.Conf, "") fmt.Println() - fmt.Println("Server is running at:") - fmt.Printf(" - %-7s: %s\n", "Local", utils.Colorize(utils.ColorGreen, fmt.Sprintf("http://127.0.0.1:%d", port))) ipv4s, err := ip.GetIPv4NetworkIPs() if ipv4s != nil && err == nil { + fmt.Println("Server is running at:") for _, ip := range ipv4s { fmt.Printf(" - %-7s: %s\n", "Network", utils.Colorize(utils.ColorGreen, fmt.Sprintf("http://%s:%d", ip, port))) } } - - fmt.Println() - fmt.Println("Server available routes:") - mygin.PrintRoute(srv.Handler.(*gin.Engine)) fmt.Println() }