diff options
author | Vidhu Kant Sharma <vidhukant@vidhukant.com> | 2023-09-03 18:34:56 +0530 |
---|---|---|
committer | Vidhu Kant Sharma <vidhukant@vidhukant.com> | 2023-09-03 18:34:56 +0530 |
commit | 020fc720379255832aad369dfc2dece9a1cf4699 (patch) | |
tree | 25e3f1ee3349b0d6f536d91a76a6d9a334bea03d /main.go | |
parent | 776522d8741752832981b17ec81deb11a298ef57 (diff) |
added pretty startup messages
Diffstat (limited to 'main.go')
-rw-r--r-- | main.go | 10 |
1 files changed, 8 insertions, 2 deletions
@@ -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")) } |