From 7b8a8254899520546d007a99eb7833a1e6ada0c4 Mon Sep 17 00:00:00 2001 From: boojack Date: Fri, 20 May 2022 22:48:36 +0800 Subject: [PATCH] chore: add greeting banner --- bin/server/cmd/root.go | 19 ++++++++++++++++--- server/server.go | 2 +- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/bin/server/cmd/root.go b/bin/server/cmd/root.go index a8572e46..dddf8fdd 100644 --- a/bin/server/cmd/root.go +++ b/bin/server/cmd/root.go @@ -9,6 +9,17 @@ import ( "memos/store" ) +const ( + greetingBanner = ` +███╗ ███╗███████╗███╗ ███╗ ██████╗ ███████╗ +████╗ ████║██╔════╝████╗ ████║██╔═══██╗██╔════╝ +██╔████╔██║█████╗ ██╔████╔██║██║ ██║███████╗ +██║╚██╔╝██║██╔══╝ ██║╚██╔╝██║██║ ██║╚════██║ +██║ ╚═╝ ██║███████╗██║ ╚═╝ ██║╚██████╔╝███████║ +╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝ ╚═════╝ ╚══════╝ +` +) + type Main struct { profile *common.Profile } @@ -37,9 +48,11 @@ func Execute() { profile: profile, } - err := m.Run() - if err != nil { - fmt.Printf("%+v\n", err) + println(greetingBanner) + fmt.Printf("Version %s has started at :%d\n", profile.Version, profile.Port) + + if err := m.Run(); err != nil { + fmt.Printf("error: %+v\n", err) os.Exit(1) } } diff --git a/server/server.go b/server/server.go index d68bd3ba..2ecab4e2 100644 --- a/server/server.go +++ b/server/server.go @@ -25,7 +25,7 @@ func NewServer(profile *common.Profile) *Server { e := echo.New() e.Debug = true e.HideBanner = true - e.HidePort = false + e.HidePort = true e.Use(middleware.LoggerWithConfig(middleware.LoggerConfig{ Format: "${method} ${uri} ${status}\n",