config.go 868 B

12345678910111213141516171819202122232425262728293031323334353637
  1. package http
  2. import (
  3. bm "go-common/library/net/http/blademaster"
  4. )
  5. // push config update
  6. func push(c *bm.Context) {
  7. var (
  8. err error
  9. param = new(struct {
  10. Ver int64 `form:"version" validate:"gte=0"`
  11. App string `form:"service" validate:"required"`
  12. BVer string `form:"build_ver" validate:"required"`
  13. Env string `form:"environment" validate:"required"`
  14. })
  15. )
  16. if err = c.Bind(param); err != nil {
  17. return
  18. }
  19. c.JSON(nil, svr.Push(c, param.App, param.BVer, param.Env, param.Ver))
  20. }
  21. func setToken(c *bm.Context) {
  22. var (
  23. err error
  24. param = new(struct {
  25. App string `form:"service" validate:"required"`
  26. Token string `form:"token" validate:"required"`
  27. Env string `form:"environment" validate:"required"`
  28. })
  29. )
  30. if err = c.Bind(param); err != nil {
  31. return
  32. }
  33. c.JSON(nil, svr.SetToken(c, param.App, param.Env, param.Token))
  34. }