MCPcopy Create free account
hub / github.com/1Panel-dev/1Panel / LoadAPIAuthConfig

Function LoadAPIAuthConfig

core/app/auth/api_auth.go:73–94  ·  view source on GitHub ↗
(_ *gin.Context)

Source from the content-addressed store, hash-verified

71}
72
73func 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
96func isValid1PanelTimestamp(panelTimestamp string, apiKeyValidityTime int) bool {
97 apiTime := apiKeyValidityTime

Callers

nothing calls this directly

Calls 1

GetValueByKeyMethod · 0.95

Tested by

no test coverage detected