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:
2026-11-20 22:31:35 +01:00
parent 461f525f20
commit 5cb45138df
15 changed files with 741 additions and 16 deletions

View File

@ -4,16 +4,19 @@ import (
"encoding/hex"
"fmt"
"os"
"time"
)
type Config struct {
DatabaseURL string
JWTSecret string
EncryptionKey []byte
Port string
ScraperURL string
AdminEmail string
AdminPassword string
OpenFIGIAPIKey string
OpenFIGITimeout time.Duration
DatabaseURL string
JWTSecret string
EncryptionKey []byte
Port string
ScraperURL string
AdminEmail string
AdminPassword string
}
func Load() (*Config, error) {
@ -46,13 +49,23 @@ func Load() (*Config, error) {
scraperURL = "http://scraper:3001"
}
timeout := 5 * time.Second
if value := os.Getenv("OPENFIGI_TIMEOUT"); value != "" {
parsed, err := time.ParseDuration(value)
if err != nil || parsed <= 0 || parsed > 30*time.Second {
return nil, fmt.Errorf("OPENFIGI_TIMEOUT must be a duration greater than 0 and at most 30s")
}
timeout = parsed
}
return &Config{
DatabaseURL: dbURL,
JWTSecret: jwtSecret,
EncryptionKey: encKey,
Port: port,
ScraperURL: scraperURL,
AdminEmail: os.Getenv("ADMIN_EMAIL"),
AdminPassword: os.Getenv("ADMIN_PASSWORD"),
OpenFIGIAPIKey: os.Getenv("OPENFIGI_API_KEY"),
OpenFIGITimeout: timeout,
DatabaseURL: dbURL,
JWTSecret: jwtSecret,
EncryptionKey: encKey,
Port: port,
ScraperURL: scraperURL,
AdminEmail: os.Getenv("ADMIN_EMAIL"),
AdminPassword: os.Getenv("ADMIN_PASSWORD"),
}, nil
}