2023-10-23 22:01:09 -04:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
2023-11-07 22:34:57 -05:00
|
|
|
"fmt"
|
2023-11-19 10:37:45 -05:00
|
|
|
"os"
|
2023-10-23 22:01:09 -04:00
|
|
|
|
2023-11-19 10:37:45 -05:00
|
|
|
"git.preston-baxter.com/Preston_PLB/capstone/frontend-service/config"
|
|
|
|
"git.preston-baxter.com/Preston_PLB/capstone/webhook-service/controllers"
|
2023-10-23 22:01:09 -04:00
|
|
|
"github.com/gin-gonic/gin"
|
|
|
|
)
|
|
|
|
|
|
|
|
func main() {
|
2023-11-19 10:37:45 -05:00
|
|
|
config.Init()
|
2023-10-23 22:01:09 -04:00
|
|
|
r := gin.Default()
|
2023-11-07 22:34:57 -05:00
|
|
|
|
2023-11-19 10:37:45 -05:00
|
|
|
controllers.BuildRouter(r)
|
2023-11-07 22:34:57 -05:00
|
|
|
|
2023-11-19 10:37:45 -05:00
|
|
|
var addr string
|
|
|
|
if port := os.Getenv("PORT"); port != "" {
|
|
|
|
addr = fmt.Sprintf("0.0.0.0:%s", port)
|
|
|
|
} else {
|
2023-11-19 21:51:05 -05:00
|
|
|
addr = "0.0.0.0:8080"
|
2023-11-19 10:37:45 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
err := r.Run(addr)
|
|
|
|
if err != nil {
|
|
|
|
panic(err)
|
|
|
|
}
|
2023-10-23 22:01:09 -04:00
|
|
|
}
|