diff --git a/pkg/config/config.go b/pkg/config/config.go index 9de6a7d..a836e10 100644 --- a/pkg/config/config.go +++ b/pkg/config/config.go @@ -34,6 +34,7 @@ func ReadConfiguration() (cfg *AppConfig, err error) { "patreonClientId": "PATREON_CLIENT_ID", "patreonSecret": "PATREON_SECRET", "postgresConnectionUrl": "POSTGRES_CONNECTION_URL", + "redisUrl": "REDIS_CONNECTION_URL", } for k, v := range envmap { diff --git a/pkg/server/server.go b/pkg/server/server.go index d1f7799..2bfe45a 100644 --- a/pkg/server/server.go +++ b/pkg/server/server.go @@ -2,7 +2,10 @@ package server import ( "context" + "go/build" + "log" "net/http" + "path" "github.com/gin-gonic/gin" itunes "github.com/mxpv/podcast" @@ -20,6 +23,20 @@ func MakeHandlers(feed feed) http.Handler { r := gin.New() r.Use(gin.Recovery()) + // Static files + HTML + + rootDir := path.Join(build.Default.GOPATH, "src/github.com/mxpv/podsync") + log.Printf("Using root directory: %s", rootDir) + + r.Static("/assets", path.Join(rootDir, "assets")) + r.LoadHTMLGlob(path.Join(rootDir, "templates/*.html")) + + r.GET("/", func(c *gin.Context) { + c.HTML(http.StatusOK, "index.html", gin.H{"title": "Index page"}) + }) + + // REST API + r.GET("/ping", func(c *gin.Context) { c.String(http.StatusOK, "ok") }) diff --git a/templates/index.html b/templates/index.html new file mode 100644 index 0000000..109f958 --- /dev/null +++ b/templates/index.html @@ -0,0 +1,5 @@ + +

+ {{ .title }} +

+ \ No newline at end of file