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.

30 lines
768 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. // @return err error
  20. func SetSystemConfig(s model.System) (err error) {
  21. cs := utils.StructToMap(s.Config)
  22. for k, v := range cs {
  23. global.GVA_VP.Set(k, v)
  24. }
  25. err = global.GVA_VP.WriteConfig()
  26. return err
  27. }