You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

33 lines
820 B

  1. package service
  2. import (
  3. "gin-vue-admin/config"
  4. "gin-vue-admin/global"
  5. "gin-vue-admin/model"
  6. "gin-vue-admin/utils"
  7. )
  8. // @title GetSystemConfig
  9. // @description 读取配置文件
  10. // @auth (2020/04/05 20:22)
  11. // @return err error
  12. // @return conf Server
  13. func GetSystemConfig() (err error, conf config.Server) {
  14. return nil, global.GVA_CONFIG
  15. }
  16. // @title SetSystemConfig
  17. // @description set system config, 设置配置文件
  18. // @auth (2020/04/05 20:22)
  19. // @param system model.System
  20. // @return err error
  21. func SetSystemConfig(system model.System) (err error) {
  22. cs := utils.StructToMap(system.Config)
  23. for k, v := range cs {
  24. global.GVA_VP.Set(k, v)
  25. }
  26. err = global.GVA_VP.WriteConfig()
  27. return err
  28. }