aboutsummaryrefslogtreecommitdiff
path: root/main.go
diff options
context:
space:
mode:
authorVidhu Kant Sharma <vidhukant@vidhukant.com>2023-09-03 18:34:56 +0530
committerVidhu Kant Sharma <vidhukant@vidhukant.com>2023-09-03 18:34:56 +0530
commit020fc720379255832aad369dfc2dece9a1cf4699 (patch)
tree25e3f1ee3349b0d6f536d91a76a6d9a334bea03d /main.go
parent776522d8741752832981b17ec81deb11a298ef57 (diff)
added pretty startup messages
Diffstat (limited to 'main.go')
-rw-r--r--main.go10
1 files changed, 8 insertions, 2 deletions
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"))
}