feat(indices): add authenticated OpenFIGI search
Add the bounded OpenFIGI v3 adapter, authenticated search route, and server-side configuration. Refs #3 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
31
backend/internal/config/openfigi_test.go
Normal file
31
backend/internal/config/openfigi_test.go
Normal file
@ -0,0 +1,31 @@
|
||||
package config
|
||||
|
||||
import (
|
||||
"strings"
|
||||
"testing"
|
||||
"time"
|
||||
)
|
||||
|
||||
func TestOpenFIGIConfiguration(t *testing.T) {
|
||||
t.Setenv("DATABASE_URL", "test-only")
|
||||
t.Setenv("JWT_SECRET", "test-only")
|
||||
t.Setenv("ENCRYPTION_KEY", strings.Repeat("01", 32))
|
||||
t.Setenv("OPENFIGI_API_KEY", "test-only-key")
|
||||
t.Setenv("OPENFIGI_TIMEOUT", "")
|
||||
cfg, err := Load()
|
||||
if err != nil || cfg.OpenFIGIAPIKey != "test-only-key" || cfg.OpenFIGITimeout != 5*time.Second {
|
||||
t.Fatal("invalid defaults", err)
|
||||
}
|
||||
t.Setenv("OPENFIGI_TIMEOUT", "2s")
|
||||
cfg, err = Load()
|
||||
if err != nil || cfg.OpenFIGITimeout != 2*time.Second {
|
||||
t.Fatal("timeout override", err)
|
||||
}
|
||||
for _, value := range []string{"invalid-secret-value", "0s", "-1s", "31s"} {
|
||||
t.Setenv("OPENFIGI_TIMEOUT", value)
|
||||
_, err = Load()
|
||||
if err == nil || strings.Contains(err.Error(), "invalid-secret-value") {
|
||||
t.Fatal("invalid timeout accepted or leaked")
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user