|
@@ -21,7 +21,7 @@ import (
|
|
|
"code.osinet.fr/fgm/sqs_demo/front"
|
|
|
)
|
|
|
|
|
|
-func SetupRoutes(rd redriver.Redriver, ms redriver.MessageStore, renderer *template.Template, storeSecret, csrfSecret []byte) *gin.Engine {
|
|
|
+func SetupRoutes(rd redriver.Redriver, ms redriver.MessageStore, renderer *template.Template, storeSecret, csrfSecret []byte, prefix string) *gin.Engine {
|
|
|
const assetsPrefix = "/assets/"
|
|
|
r := gin.Default()
|
|
|
r.SetHTMLTemplate(renderer)
|
|
@@ -46,7 +46,7 @@ func SetupRoutes(rd redriver.Redriver, ms redriver.MessageStore, renderer *templ
|
|
|
r.GET("/queue/:name", makeQueueHandler(rd, ms))
|
|
|
|
|
|
// JSON done
|
|
|
- r.GET("/", makeHomeHandler(rd))
|
|
|
+ r.GET("/", makeHomeHandler(rd, prefix))
|
|
|
|
|
|
// TODO
|
|
|
r.POST("/queue/:name/delete", mw, makeDeleteHandler(rd)) // Needs mw to check token.
|
|
@@ -57,13 +57,14 @@ func SetupRoutes(rd redriver.Redriver, ms redriver.MessageStore, renderer *templ
|
|
|
|
|
|
func HttpService(dic *izidic.Container) (any, error) {
|
|
|
csrfSecret := dic.MustParam(services.PCSRFSecret).([]byte)
|
|
|
+ prefix := dic.MustParam(services.PPrefix).(string)
|
|
|
storeSecret := dic.MustParam(services.PStoreSecret).([]byte)
|
|
|
|
|
|
rd := dic.MustService(services.SvcRedriver).(redriver.Redriver)
|
|
|
re := dic.MustService(services.SvcRenderer).(*template.Template)
|
|
|
ms := dic.MustService(services.SvcMessageStore).(redriver.MessageStore)
|
|
|
|
|
|
- return SetupRoutes(rd, ms, re, storeSecret, csrfSecret), nil
|
|
|
+ return SetupRoutes(rd, ms, re, storeSecret, csrfSecret, prefix), nil
|
|
|
}
|
|
|
|
|
|
func RendererService(_ *izidic.Container) (any, error) {
|