From 020fc720379255832aad369dfc2dece9a1cf4699 Mon Sep 17 00:00:00 2001 From: Vidhu Kant Sharma Date: Sun, 3 Sep 2023 18:34:56 +0530 Subject: added pretty startup messages --- main.go | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'main.go') diff --git a/main.go b/main.go index 6b9704c..cf54d25 100644 --- a/main.go +++ b/main.go @@ -39,10 +39,15 @@ import ( const OPENBILLS_VERSION = "v0.0.1" -func main() { - log.Printf("\x1b[46m\x1b[30m[info]\x1b[0m Starting OpenBills Server %s\n", OPENBILLS_VERSION) +func init() { + if viper.GetBool("production_mode") { + gin.SetMode(gin.ReleaseMode) + } +} +func main() { r := gin.New() + r.SetTrustedProxies([]string{"127.0.0.1"}) r.GET("/info", serverInfo) @@ -60,5 +65,6 @@ func main() { item.Routes(protected) } + log.Printf("\x1b[46m\x1b[30m[info]\x1b[0m Running OpenBills Server %s\n", OPENBILLS_VERSION) r.Run(":" + viper.GetString("port")) } -- cgit v1.2.3