feat/sync-setting:

+ moved infra/sync-cfg to infra/sync-consumer-cfg
+ adjut anything related to old infra/sync
+ infra/sync is now have new setting for the sync
This commit is contained in:
2025-11-28 09:16:38 +07:00
parent 8360da06c8
commit b09c9f183c
29 changed files with 187 additions and 39 deletions

No files matched your search

+3 -3
View File
@@ -8,8 +8,8 @@ import (
func SetConfig() {
a.ParseSingleCfg(&O)
if O.Host == "" || O.Prefix == "" {
panic("config sync host and prefix empty")
if O.NewSecretKey == "" || O.NewHost == "" || O.OldSecretKey == "" || O.OldHost == "" {
panic("secret key and host of the sync partner config can not be empty")
}
lo.I.Println("sync url config loaded, status: DONE!!")
lo.I.Println("sync partner config loaded, status: DONE!!")
}
+9 -5
View File
@@ -1,9 +1,13 @@
package synccfg
var O SyncUrlCfg = SyncUrlCfg{}
var O PartnerCfg = PartnerCfg{} // old
type SyncUrlCfg struct {
Prefix string `yaml:"prefix"`
Host string `yaml:"host"`
Enable bool `yaml:"enable"`
// Used by sync itself, so any partner should be stated here
type PartnerCfg struct {
OldSource string `yaml:"oldSource"`
OldSecretKey string `yaml:"oldSecretKey"`
OldHost string `yaml:"oldHost"`
NewSource string `yaml:"newSource"`
NewSecretKey string `yaml:"newSecretKey"`
NewHost string `yaml:"newHost"`
}
@@ -0,0 +1,15 @@
package synccfg
import (
a "github.com/karincake/apem"
lo "github.com/karincake/apem/loggero"
)
func SetConfig() {
a.ParseSingleCfg(&O)
if O.TargetHost == "" || O.Prefix == "" {
panic("config sync host and prefix empty")
}
lo.I.Println("sync url config loaded, status: DONE!!")
}
@@ -0,0 +1,11 @@
package synccfg
var O SyncUrlCfg = SyncUrlCfg{} // old
type SyncUrlCfg struct {
Prefix string `yaml:"prefix"`
TargetHost string `yaml:"targetHost"`
Enable bool `yaml:"enable"`
Source string `yaml:"source"`
SecretKey string `yaml:"secretKey"`
}