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:
zenfun
2025-12-17 00:33:36 +08:00
parent 51e55cb036
commit 2e3b471533
4 changed files with 159 additions and 2 deletions

View File

@@ -92,7 +92,7 @@ func main() {
logger.Info("connected to postgresql successfully")
// Auto Migrate
if err := db.AutoMigrate(&model.Master{}, &model.Key{}, &model.Provider{}, &model.Model{}, &model.LogRecord{}); err != nil {
if err := db.AutoMigrate(&model.Master{}, &model.Key{}, &model.Provider{}, &model.Model{}, &model.Binding{}, &model.LogRecord{}); err != nil {
fatal(logger, "failed to auto migrate", "err", err)
}