Add support for .env configuration and privacy page (closes #44)

This commit is contained in:
video-prize-ranch
2022-08-04 19:41:55 -04:00
parent 4da9b74949
commit d50cf2da86
11 changed files with 306 additions and 13 deletions

View File

@@ -1,6 +1,7 @@
package main
import (
"flag"
"fmt"
"net/http"
@@ -12,9 +13,15 @@ import (
"github.com/gofiber/fiber/v2/middleware/filesystem"
"github.com/gofiber/fiber/v2/middleware/recover"
"github.com/gofiber/template/handlebars"
"github.com/joho/godotenv"
)
func main() {
envPath := flag.String("c", ".env", "Path to env file")
err := godotenv.Load(*envPath)
if err != nil {
fmt.Println(err)
}
utils.LoadConfig()
engine := handlebars.NewFileSystem(http.FS(views.GetFiles()), ".hbs")
@@ -51,6 +58,7 @@ func main() {
})
app.Get("/", pages.HandleFrontpage)
app.Get("/privacy", pages.HandlePrivacy)
app.Get("/:postID.gifv", pages.HandleGifv)
app.Get("/:baseName.:extension", pages.HandleMedia)
app.Get("/:postID", pages.HandlePost)