update
This commit is contained in:
@@ -8,14 +8,14 @@ import (
|
||||
"management/internal/pkg/render"
|
||||
)
|
||||
|
||||
type App struct {
|
||||
type app struct {
|
||||
config *config.Config
|
||||
render render.Renderer
|
||||
captchaService v1.CaptchaService
|
||||
}
|
||||
|
||||
func NewApp(config *config.Config, render render.Renderer, captchaService v1.CaptchaService) *App {
|
||||
return &App{
|
||||
func newApp(config *config.Config, render render.Renderer, captchaService v1.CaptchaService) *app {
|
||||
return &app{
|
||||
config: config,
|
||||
render: render,
|
||||
captchaService: captchaService,
|
||||
@@ -29,7 +29,7 @@ type Response struct {
|
||||
OpenCaptcha int `json:"open_captcha"`
|
||||
}
|
||||
|
||||
func (a *App) captcha(w http.ResponseWriter, _ *http.Request) {
|
||||
func (a *app) captcha(w http.ResponseWriter, _ *http.Request) {
|
||||
id, b64s, _, err := a.captchaService.Generate(
|
||||
a.config.Captcha.ImgHeight,
|
||||
a.config.Captcha.ImgWidth,
|
||||
|
||||
@@ -15,6 +15,6 @@ type Config struct {
|
||||
}
|
||||
|
||||
func Routes(r chi.Router, cfg Config) {
|
||||
app := NewApp(cfg.Conf, cfg.Render, cfg.CaptchaService)
|
||||
app := newApp(cfg.Conf, cfg.Render, cfg.CaptchaService)
|
||||
r.Get("/captcha", app.captcha)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user