update:env cond
This commit is contained in:
34
main.go
34
main.go
@@ -25,22 +25,26 @@ func setupRoutesAndMiddleware() *gin.Engine {
|
|||||||
})
|
})
|
||||||
var projects = []constants.Project{
|
var projects = []constants.Project{
|
||||||
{
|
{
|
||||||
Url: "https://derrickgee.dev/projects/support-tickets",
|
Url: "https://derrickgee.dev/projects/support-ticket-demo",
|
||||||
Name: "Project One",
|
Name: "Support Ticket System",
|
||||||
Description: "A simple Go Gin + Templ app demonstrating the project pattern.",
|
Description: "",
|
||||||
TechTags: []string{"Typescript", "Javascript", "React", "Express"},
|
TechTags: []string{"typescript", "react", "fastify", "tailwindcss", "sqlite", "vite", "bun"},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Url: "https://derrickgee.dev/projects/support-tickets",
|
Url: "/projects/dotfiles",
|
||||||
Name: "Project Two",
|
Name: "Linux Dotfiles",
|
||||||
Description: "A simple Go Gin + Templ app demonstrating the project pattern.",
|
Description: "Configurations for Linux",
|
||||||
TechTags: []string{"Go", "Bash"},
|
TechTags: []string{"Linux", "Lua", "Bash", "Python"},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
r.GET("/projects", func(c *gin.Context) {
|
r.GET("/projects", func(c *gin.Context) {
|
||||||
page := pages.ProjectPage(projects)
|
page := pages.ProjectPage(projects)
|
||||||
page.Render(c.Request.Context(), c.Writer)
|
page.Render(c.Request.Context(), c.Writer)
|
||||||
})
|
})
|
||||||
|
// r.GET("/projects/dotfiles", func(c *gin.Context) {
|
||||||
|
// page := pages.Dotfiles()
|
||||||
|
// page.Render(c.Request.Context(), c.Writer)
|
||||||
|
// })
|
||||||
r.NoRoute(handlers.NotFoundHandler)
|
r.NoRoute(handlers.NotFoundHandler)
|
||||||
return r
|
return r
|
||||||
}
|
}
|
||||||
@@ -54,13 +58,13 @@ func init() {
|
|||||||
}
|
}
|
||||||
func main() {
|
func main() {
|
||||||
router := setupRoutesAndMiddleware()
|
router := setupRoutesAndMiddleware()
|
||||||
|
ginEnv := os.Getenv("GIN_ENV")
|
||||||
// dev env
|
if ginEnv == "debug" {
|
||||||
router.SetTrustedProxies(nil)
|
router.SetTrustedProxies(nil)
|
||||||
|
} else {
|
||||||
// prod env
|
router.SetTrustedProxies([]string{"127.0.0.1"})
|
||||||
// router.SetTrustedProxies([]string{"127.0.0.1"})
|
router.TrustedPlatform = gin.PlatformCloudflare
|
||||||
// router.TrustedPlatform = gin.PlatformCloudflare
|
}
|
||||||
|
|
||||||
srv := &http.Server{
|
srv := &http.Server{
|
||||||
Addr: ":3500",
|
Addr: ":3500",
|
||||||
|
|||||||
Reference in New Issue
Block a user