simplify Noform Option

This commit is contained in:
Gianni Carafa
2023-11-02 20:21:24 +01:00
parent b786796595
commit e3389d2df3
2 changed files with 13 additions and 13 deletions

View File

@@ -1,16 +1,20 @@
package handlers
import "github.com/gofiber/fiber/v2"
import (
"os"
func NoForm(c *fiber.Ctx) error {
c.Set("Content-Type", "text/html")
c.SendStatus(fiber.StatusNotFound)
return c.SendString("Form Disabled")
}
"github.com/gofiber/fiber/v2"
)
func Form(c *fiber.Ctx) error {
c.Set("Content-Type", "text/html")
return c.SendString(html)
if os.Getenv("DISABLE_FORM") == "true" {
c.Set("Content-Type", "text/html")
c.SendStatus(fiber.StatusNotFound)
return c.SendString("Form Disabled")
} else {
c.Set("Content-Type", "text/html")
return c.SendString(html)
}
}
const html = `