mirror of
https://github.com/EZ-Api/ez-api.git
synced 2026-01-13 17:47:51 +00:00
feat(core): implement namespace support and routing bindings
Introduce namespace-aware routing capabilities through a new Binding model and updates to Master/Key entities. - Add Binding model for configuring model routes per namespace - Add DefaultNamespace and Namespaces fields to Master and Key models - Update auto-migration to include Binding table - Implement Redis synchronization for binding configurations - Propagate namespace settings during master creation and key issuance
This commit is contained in:
@@ -46,6 +46,8 @@ func (s *MasterService) CreateMaster(name, group string, maxChildKeys, globalQPS
|
||||
MasterKey: string(hashedMasterKey),
|
||||
MasterKeyDigest: masterKeyDigest,
|
||||
Group: group,
|
||||
DefaultNamespace: "default",
|
||||
Namespaces: "default",
|
||||
MaxChildKeys: maxChildKeys,
|
||||
GlobalQPS: globalQPS,
|
||||
Status: "active",
|
||||
@@ -150,10 +152,18 @@ func (s *MasterService) issueChildKey(masterID uint, group string, scopes string
|
||||
TokenHash: tokenHash,
|
||||
Group: group,
|
||||
Scopes: scopes,
|
||||
DefaultNamespace: strings.TrimSpace(master.DefaultNamespace),
|
||||
Namespaces: strings.TrimSpace(master.Namespaces),
|
||||
IssuedAtEpoch: master.Epoch,
|
||||
Status: "active",
|
||||
IssuedBy: strings.TrimSpace(issuedBy),
|
||||
}
|
||||
if strings.TrimSpace(key.DefaultNamespace) == "" {
|
||||
key.DefaultNamespace = "default"
|
||||
}
|
||||
if strings.TrimSpace(key.Namespaces) == "" {
|
||||
key.Namespaces = key.DefaultNamespace
|
||||
}
|
||||
if key.IssuedBy == "" {
|
||||
key.IssuedBy = "master"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user