This commit is contained in:
@@ -13,6 +13,7 @@ func StartInitSystemConfig(svc *svc.ServiceContext) {
|
||||
Invite(svc)
|
||||
Verify(svc)
|
||||
Subscribe(svc)
|
||||
Signature(svc)
|
||||
Register(svc)
|
||||
Mobile(svc)
|
||||
Currency(svc)
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
DELETE
|
||||
FROM `system`
|
||||
WHERE `category` = 'signature'
|
||||
AND `key` = 'EnableSignature';
|
||||
@@ -0,0 +1,14 @@
|
||||
INSERT INTO `system` (`category`, `key`, `value`, `type`, `desc`, `created_at`, `updated_at`)
|
||||
SELECT 'signature',
|
||||
'EnableSignature',
|
||||
'false',
|
||||
'bool',
|
||||
'Enable signature verification for public APIs',
|
||||
NOW(3),
|
||||
NOW(3)
|
||||
WHERE NOT EXISTS (
|
||||
SELECT 1
|
||||
FROM `system`
|
||||
WHERE `category` = 'signature'
|
||||
AND `key` = 'EnableSignature'
|
||||
);
|
||||
@@ -0,0 +1,22 @@
|
||||
package initialize
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/perfect-panel/server/internal/config"
|
||||
"github.com/perfect-panel/server/internal/svc"
|
||||
"github.com/perfect-panel/server/pkg/logger"
|
||||
"github.com/perfect-panel/server/pkg/tool"
|
||||
)
|
||||
|
||||
func Signature(svc *svc.ServiceContext) {
|
||||
logger.Debug("Signature config initialization")
|
||||
configs, err := svc.SystemModel.GetSignatureConfig(context.Background())
|
||||
if err != nil {
|
||||
logger.Error("[Init Signature Config] Get Signature Config Error: ", logger.Field("error", err.Error()))
|
||||
return
|
||||
}
|
||||
var signatureConfig config.Signature
|
||||
tool.SystemConfigSliceReflectToStruct(configs, &signatureConfig)
|
||||
svc.Config.Signature = signatureConfig
|
||||
}
|
||||
Reference in New Issue
Block a user