(_ *gin.Context)
| 71 | } |
| 72 | |
| 73 | func LoadAPIAuthConfig(_ *gin.Context) (APIAuthConfig, error) { |
| 74 | settingRepo := repo.NewISettingRepo() |
| 75 | config := APIAuthConfig{} |
| 76 | var err error |
| 77 | if config.ApiInterfaceStatus, err = settingRepo.GetValueByKey("ApiInterfaceStatus"); err != nil { |
| 78 | return config, err |
| 79 | } |
| 80 | if config.ApiKey, err = settingRepo.GetValueByKey("ApiKey"); err != nil { |
| 81 | return config, err |
| 82 | } |
| 83 | if config.IpWhiteList, err = settingRepo.GetValueByKey("IpWhiteList"); err != nil { |
| 84 | return config, err |
| 85 | } |
| 86 | apiValidity, err := settingRepo.GetValueByKey("ApiKeyValidityTime") |
| 87 | if err != nil { |
| 88 | return config, err |
| 89 | } |
| 90 | if config.ApiKeyValidityTime, err = strconv.Atoi(apiValidity); err != nil { |
| 91 | return config, err |
| 92 | } |
| 93 | return config, nil |
| 94 | } |
| 95 | |
| 96 | func isValid1PanelTimestamp(panelTimestamp string, apiKeyValidityTime int) bool { |
| 97 | apiTime := apiKeyValidityTime |
nothing calls this directly
no test coverage detected