feat(shared-sqs): fixed demo credentials + BYOC foundation (v0.1.9)

- seed.go: CreateFixed с хардкод credentials для demo-service
  AccessKey=SSAK-demo-shared-sqs (постоянные, README всегда актуален)
- tenant_store: добавлен CreateFixed для задания произвольных credentials
- deployment.yaml: v0.1.9
- doc/byoc-credentials.md: полная документация BYOC фичи (TODO для API+UI)
This commit is contained in:
“Naeel”
2026-04-09 20:05:02 +03:00
parent 990a89e7aa
commit f878c4cc6f
3 changed files with 157 additions and 1 deletions
+25
View File
@@ -71,6 +71,31 @@ s.mu.Unlock()
return t, nil
}
// CreateFixed — создаёт тенанта с заранее известными credentials (для seed/demo).
// Используется только при инициализации демо-данных; не вызывается из user-facing API.
func (s *TenantStore) CreateFixed(name string, maxQueues int, tenantID, accessKey, secretKey string) (*Tenant, error) {
s.mu.Lock()
defer s.mu.Unlock()
if _, exists := s.byID[tenantID]; exists {
return nil, fmt.Errorf("tenant with id %s already exists", tenantID)
}
if _, exists := s.byAccessKey[accessKey]; exists {
return nil, fmt.Errorf("tenant with access key %s already exists", accessKey)
}
t := &Tenant{
ID: tenantID,
Name: name,
AccessKey: accessKey,
SecretKey: secretKey,
MaxQueues: maxQueues,
CreatedAt: time.Now().UTC(),
Active: true,
}
s.byID[t.ID] = t
s.byAccessKey[t.AccessKey] = t
return t, nil
}
// GetByAccessKey — поиск тенанта по AccessKeyId (используется в auth middleware).
func (s *TenantStore) GetByAccessKey(accessKey string) (*Tenant, bool) {
s.mu.RLock()