17 lines
461 B
Go
17 lines
461 B
Go
package middleware
|
|
|
|
import (
|
|
"github.com/labstack/echo/v4"
|
|
"github.com/camzawacki/personal-site/config"
|
|
"github.com/camzawacki/personal-site/internal/context"
|
|
)
|
|
|
|
// Config stores the configuration in the request so it can be accessed by the ui.
|
|
func Config(cfg *config.Config) echo.MiddlewareFunc {
|
|
return func(next echo.HandlerFunc) echo.HandlerFunc {
|
|
return func(ctx echo.Context) error {
|
|
ctx.Set(context.ConfigKey, cfg)
|
|
return next(ctx)
|
|
}
|
|
}
|
|
}
|