58 lines
1.7 KiB
Go
58 lines
1.7 KiB
Go
package config
|
|
|
|
type OpenSdkConfigure struct {
|
|
ProdUrl string // 生产环境地址
|
|
DevEnv bool // 是否是测试环境
|
|
DevUrl string // 测试环境地址
|
|
CertPath string // 证书路径
|
|
CertProtectionPwd string // 证书密码
|
|
KeyId string // 默认使用keyId
|
|
KeyConfigures map[string]*KeyConfigure // 多租户密钥配置
|
|
}
|
|
|
|
type KeyConfigure struct {
|
|
KeyId string // keyId
|
|
PriKey string // 私钥
|
|
RespPubKey string // 公钥
|
|
ReqParamEncryptKey string // 堆成加密密钥
|
|
KeySignType string // 签名类型
|
|
RespSignSwitch bool // 是否开启响应报文签名
|
|
RespSignAlgorithm string // 响应报文签名算法
|
|
CertProtectionPwd string
|
|
GrayConfigure map[string]string
|
|
XCfcaBasic string
|
|
EnterpriseBearer string
|
|
}
|
|
|
|
func DefaultConfig() OpenSdkConfigure {
|
|
configure := OpenSdkConfigure{
|
|
DevEnv: true,
|
|
ProdUrl: "https://open.cibfintech.com",
|
|
DevUrl: "https://open.test.cibfintech.com",
|
|
}
|
|
|
|
return configure
|
|
}
|
|
|
|
func NewConfig(config *KeyConfigure) OpenSdkConfigure {
|
|
configure := OpenSdkConfigure{
|
|
DevEnv: true,
|
|
ProdUrl: "https://open.cibfintech.com",
|
|
DevUrl: "https://open.test.cibfintech.com",
|
|
}
|
|
|
|
configure.KeyConfigures[config.KeyId] = config
|
|
return configure
|
|
}
|
|
func GetConfigure() KeyConfigure {
|
|
return KeyConfigure{}
|
|
}
|
|
|
|
func (config *OpenSdkConfigure) AddKeyConfigure(configure *KeyConfigure) {
|
|
config.KeyConfigures[configure.KeyId] = configure
|
|
}
|
|
|
|
func (config *OpenSdkConfigure) GetKeyConfigure(keyId string) *KeyConfigure {
|
|
return config.KeyConfigures[keyId]
|
|
}
|