feat: extract some configs from access to apply logic

This commit is contained in:
Fu Diwei
2025-01-11 16:31:28 +08:00
parent a0c08e841d
commit 598d0705fb
21 changed files with 647 additions and 427 deletions

View File

@@ -1,6 +1,9 @@
package domain
import "time"
import (
"encoding/json"
"time"
)
type Access struct {
Meta
@@ -11,6 +14,15 @@ type Access struct {
DeletedAt time.Time `json:"deleted" db:"deleted"`
}
func (a *Access) UnmarshalConfigToMap() (map[string]any, error) {
config := make(map[string]any)
if err := json.Unmarshal([]byte(a.Config), &config); err != nil {
return nil, err
}
return config, nil
}
type AccessConfigForACMEHttpReq struct {
Endpoint string `json:"endpoint"`
Mode string `json:"mode"`
@@ -26,8 +38,6 @@ type AccessConfigForAliyun struct {
type AccessConfigForAWS struct {
AccessKeyId string `json:"accessKeyId"`
SecretAccessKey string `json:"secretAccessKey"`
Region string `json:"region"`
HostedZoneId string `json:"hostedZoneId"`
}
type AccessConfigForBaiduCloud struct {
@@ -57,7 +67,6 @@ type AccessConfigForGoDaddy struct {
type AccessConfigForHuaweiCloud struct {
AccessKeyId string `json:"accessKeyId"`
SecretAccessKey string `json:"secretAccessKey"`
Region string `json:"region"`
}
type AccessConfigForLocal struct{}