mirror of
https://github.com/mainnika/nikita-tokarch-uk.git
synced 2026-05-25 01:03:35 +00:00
Add ghost client to renderer handler
This commit is contained in:
@@ -8,6 +8,9 @@ import (
|
|||||||
"github.com/mailru/easyjson"
|
"github.com/mailru/easyjson"
|
||||||
"github.com/valyala/fasthttp"
|
"github.com/valyala/fasthttp"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
var _ Client = (*HTTPClient)(nil)
|
||||||
|
|
||||||
// Ghost content data URIs:
|
// Ghost content data URIs:
|
||||||
const (
|
const (
|
||||||
ghostAPIPrefix = "/ghost/api/v3/"
|
ghostAPIPrefix = "/ghost/api/v3/"
|
||||||
|
|||||||
@@ -3,12 +3,14 @@ package main
|
|||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"net"
|
"net"
|
||||||
|
"time"
|
||||||
|
|
||||||
"github.com/sirupsen/logrus"
|
"github.com/sirupsen/logrus"
|
||||||
"github.com/spf13/viper"
|
"github.com/spf13/viper"
|
||||||
"github.com/valyala/fasthttp"
|
"github.com/valyala/fasthttp"
|
||||||
|
|
||||||
"code.tokarch.uk/mainnika/nikita-tokarch-uk/frontend/config"
|
"code.tokarch.uk/mainnika/nikita-tokarch-uk/frontend/config"
|
||||||
|
"code.tokarch.uk/mainnika/nikita-tokarch-uk/frontend/ghost"
|
||||||
"code.tokarch.uk/mainnika/nikita-tokarch-uk/frontend/renderer"
|
"code.tokarch.uk/mainnika/nikita-tokarch-uk/frontend/renderer"
|
||||||
|
|
||||||
_ "code.tokarch.uk/mainnika/nikita-tokarch-uk/frontend/templates"
|
_ "code.tokarch.uk/mainnika/nikita-tokarch-uk/frontend/templates"
|
||||||
@@ -51,7 +53,15 @@ func main() {
|
|||||||
logrus.Fatal(err)
|
logrus.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ghostClient := &ghost.Client{
|
||||||
|
Addr: config.Content.Backend,
|
||||||
|
ContentKey: config.Content.Key,
|
||||||
|
Secured: true,
|
||||||
|
QueryTimeout: time.Second,
|
||||||
|
}
|
||||||
|
|
||||||
rendererHandler := &renderer.Renderer{
|
rendererHandler := &renderer.Renderer{
|
||||||
|
GhostClient: ghostClient,
|
||||||
Base: config.Base,
|
Base: config.Base,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -5,11 +5,14 @@ import (
|
|||||||
|
|
||||||
routing "github.com/jackwhelpton/fasthttp-routing/v2"
|
routing "github.com/jackwhelpton/fasthttp-routing/v2"
|
||||||
"github.com/valyala/fasthttp"
|
"github.com/valyala/fasthttp"
|
||||||
|
|
||||||
|
"code.tokarch.uk/mainnika/nikita-tokarch-uk/frontend/ghost"
|
||||||
"code.tokarch.uk/mainnika/nikita-tokarch-uk/frontend/templates"
|
"code.tokarch.uk/mainnika/nikita-tokarch-uk/frontend/templates"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Renderer is the main handler that contains all routes handlers
|
// Renderer is the main handler that contains all routes handlers
|
||||||
type Renderer struct {
|
type Renderer struct {
|
||||||
|
GhostClient ghost.Client
|
||||||
Base string
|
Base string
|
||||||
|
|
||||||
router *routing.Router
|
router *routing.Router
|
||||||
|
|||||||
Reference in New Issue
Block a user