ThatAIguyA world of ideas

THE CONSCIOUSNESS ATLAS
Read. Experiment. Follow the evidence.

ConsciousnessLearn · Explore · Joseph Anady

Janady13/missionmatch / internal/platform/config/config.go

Source identity, revision, and recovered contents.

GitHub sourceSource text recovered

Source identity

FieldRecorded value
Source typeGitHub source
Original recordJanady13/missionmatch / internal/platform/config/config.go
DateNot specified in source
RepositoryJanady13/missionmatch
Revision9bde0f9a74b89d01980fa658e5253acda7528d0c
Branchper-tenant-routing
Path or archive memberinternal/platform/config/config.go
Original SHA-256d9c487aaf42b9f654aded3fa48ce04457b85b9f706e6acc71a5658313fb82373
Git blob SHAcd855f29aa918d98e741c496e439262fbeb79b33
Reading-copy SHA-256d9c487aaf42b9f654aded3fa48ce04457b85b9f706e6acc71a5658313fb82373

Original source ↗

Every recorded occurrence

These 3 records contain identical original source bytes. Their paths and revisions remain part of the archive.

Original recordBranch or archiveRevision / identifierOriginal location
Janady13/missionmatch / internal/platform/config/config.goper-tenant-routing9bde0f9a74b89d01980fa658e5253acda7528d0cOpen original
Janady13/missionmatch / internal/platform/config/config.godeploy-and-opsbdacd9d0b4d5998d25fc74bf4007f4c3ec538c7aOpen original
Janady13/missionmatch / internal/platform/config/config.goper-tenant-routing9bde0f9a74b89d01980fa658e5253acda7528d0cOpen original

Recovered source transcript

// Package config loads and validates the application's runtime configuration. // // Cloud selection is CONFIGURATION, not code (the cloud-portability mandate): the same binary runs // on AWS GovCloud or Azure Government by flipping MM_CLOUD and the provider settings. Nothing here // imports a cloud SDK, adapters live behind interfaces in their own packages and are wired in // cmd/api from this config. package config import ( "encoding/base64" "encoding/hex" "errors" "fmt" "os" "strconv" "strings" ) // Env is the deployment environment. type Env string const ( EnvDevelopment Env = "development" EnvProduction Env = "production" ) // Cloud is the target government cloud. Local is for dev (MinIO, self-hosted embeddings, no managed services). type Cloud string const ( CloudLocal Cloud = "local" CloudAWSGovCloud Cloud = "aws_govcloud" CloudAzureGov Cloud = "azure_gov" ) // Tenancy selects how a request reaches its tenant's data. "shared" is the original model: one app // pool over a single shared database with Row Level Security scoping every row by app.current_org_id. // "per_tenant" is the database per tenant model: a shared CONTROL PLANE database holds identity, auth, // and the tenant directory, and each tenant's business data lives in its OWN isolated database reached // through a per tenant pool resolved from the directory and the secrets port. RLS stays forced inside // every tenant database as defense in depth (AWS SaaS Lens silo isolation, the resource boundary is the // isolation boundary; Azure data plane vs control plane). The default is shared so the existing // deployment keeps working unchanged until the operator cuts over. type Tenancy string const ( TenancyShared Tenancy = "shared" TenancyPerTenant Tenancy = "per_tenant" ) // SecretsBackend selects how a per tenant database credential is resolved from the reference stored in // the tenant directory. "env" reads a root owned environment file (dev and staging, the keys stay on // the server rule); the government cloud backends resolve from a managed secret store (AWS Secrets // Manager, Azure Key Vault) and are wired at deploy, never compiled into the core build. type SecretsBackend string const ( SecretsEnv SecretsBackend = "env" SecretsAWSGovCloud SecretsBackend = "aws_govcloud" SecretsAzureGov SecretsBackend = "azure_gov" ) // Secrets configures the per tenant credential resolver (see internal/platform/secrets). The reference // stored in the directory is a logical pointer (a key), never a credential; the backend maps the key to // a DSN at pool open time, with a short cache TTL so a rotated credential is picked up. type Secrets struct { Backend SecretsBackend CacheTTLSeconds int } // TenantPools configures the bounded per tenant pool registry (see internal/platform/tenantpool). A // bounded number of live pools, each small, keeps MaxPools times MaxConns well under the server // max_connections (the pgx maintainer's pool per tenant guidance); idle tenants are evicted whole. type TenantPools struct { MaxPools int // most tenant pools held live at once (LRU evicted beyond this) MaxConnsPerPool int // max connections in each tenant pool (small, because there are many) IdleEvictSecs int // evict a whole tenant pool after this long with no use } // EmbeddingProvider selects the embedding adapter. "fake" is a deterministic offline provider for // dev/tests; "openai" is any OpenAI compatible endpoint (self hosted vLLM, the production CUI path, // or OpenAI); "bedrock"/"azure_openai" are the managed gov cloud adapters (wired at deploy time). type EmbeddingProvider string const ( ProviderFake EmbeddingProvider = "fake" ProviderOpenAI EmbeddingProvider = "openai" ProviderBedrock EmbeddingProvider = "bedrock" ProviderAzureOpenAI EmbeddingProvider = "azure_openai" // ProviderMegamind routes embeddings through the stateless MEGAMIND inference plane (the typed // inference client to the gateway), the production self hosted path for cleared CUI data. ProviderMegamind EmbeddingProvider = "megamind" ) // Embeddings configures the embedding provider. Dimension MUST match the vector(N) column width in // the schema (default 384); changing the provider's native dimension is a re-embed migration, not a // config flip (STACK_DECISIONS.md §6). type Embeddings struct { Provider EmbeddingProvider Endpoint string // base URL for the OpenAI-compatible / Azure endpoint Model string // e.g. "text-embedding-3-large", "amazon.titan-embed-text-v2:0", a local model id Dimension int APIKey string // bearer/api-key; for Bedrock/Azure-Entra the adapter uses cloud credentials instead MegamindURL string // base URL of the MEGAMIND gateway when Provider is "megamind" } // Inference configures the typed client to the stateless MEGAMIND inference plane (embeddings, // reranking, generation, faithfulness). The heavy models run out of process on the Apple Silicon // cluster; this is the only AI compute the FIPS API binary reaches, over HTTP. URL empty means the AI // layer is unconfigured and its routes degrade rather than fail the boot. type Inference struct { URL string // MEGAMIND gateway base, reached over Tailscale EmbedModel string // 384 dim embedder (all-minilm or bge-small-en-v1.5) RerankModel string // cross encoder (bge-reranker-v2-m3) or the cosine baseline GenerateModel string // local instruct model (e.g. llama3.1:8b) Dimension int // must match the vector(N) column width TimeoutSeconds int // per request MaxRetries int // additional attempts on a transient failure BreakerTrips int // consecutive failures before the breaker opens BreakerCoolSec int // how long the breaker stays open TeachingEnabled bool // federated craft signal transmission; disabled until multiple live clients exist } // ExtractorProvider selects the Mission Check structured extraction adapter (resume or job description // text to proposed fields). "deterministic" is the offline rules plus ontology extractor and the // default; an LLM backed provider (self hosted vLLM for CUI in production) is a future addition behind // the same port. Extraction runs server side only, so a key here never reaches the browser bundle. type ExtractorProvider string const ( ExtractorDeterministic ExtractorProvider = "deterministic" ) // Extraction configures the Mission Check structured extraction provider. Endpoint, Model, and APIKey // are reserved for a future provider backed extractor and are unused by the deterministic one. type Extraction struct { Provider ExtractorProvider Endpoint string Model string APIKey string } // Auth holds the server side secrets and tunables for the authentication module. Every secret here // loads from the environment (the root owned secrets file), never the repo or the browser bundle. type Auth struct { PepperVersion int // active credential pepper version stored on new credentials Pepper []byte // active credential pepper key (HMAC applied before PBKDF2) PepperPrevious []byte // optional prior pepper key (version PepperVersion minus 1) for rotation TOTPKEKVersion int // active TOTP secret KEK version TOTPKEK []byte // 32 byte AES 256 key encrypting TOTP secrets at rest TOTPKEKPrevious []byte // optional prior TOTP KEK (version TOTPKEKVersion minus 1) so a rotated KEK still decrypts older secrets CSRFKey []byte // HMAC key binding a CSRF token to its session RecoveryLookupKey []byte // HMAC key for recovery code lookup tags TOTPIssuer string // issuer shown in the authenticator app SessionIdleSeconds int // idle timeout (NIST 800-171 3.1.11 default 900) SessionAbsoluteSeconds int // absolute session cap (default 43200, 12 hours) PendingAbsoluteSeconds int // auth_pending (pre MFA) session cap (default 300) InviteExpirySeconds int // invite and activation link lifetime (default 259200, 72 hours) CookieSecure bool // Secure attribute on the session cookie (true except plain http dev) MFARequired bool // when false, login mints an active session after password with no TOTP step (pilot only, forbidden in production) } // Config is the fully-resolved, validated application configuration. type Config struct { Env Env HTTPAddr string Tenancy Tenancy // shared (one RLS database) or per_tenant (control plane + per tenant databases) AppDatabaseURL string // NOBYPASSRLS app role DSN. In shared mode this IS the database; in per_tenant mode it is the control plane app DSN (identity, auth, directory) MigratorDatabaseURL string // BYPASSRLS migrator role DSN (goose, and per_tenant directory writes against the control plane) ComplianceDatabaseURL string // compliance role DSN, the only path that reads the eeo schema; empty disables adverse impact reporting (503) Secrets Secrets TenantPools TenantPools DecisionRetentionDays int // retention window for identifiable screening artifacts after a decision (default 90) Cloud Cloud Embeddings Embeddings Inference Inference Extraction Extraction RequireFIPS bool // when true, cmd/api aborts unless crypto/fips140.Enabled() AllowDevHeaderAuth bool // dev only X-Org-ID resolver toggle; MUST be false in production AllowedOrigins []string // CSRF Origin allowlist for unsafe verbs; empty disables the check (dev) TrustedProxyHeader string // header carrying the real client IP (set by a trusted reverse proxy); empty uses the TCP peer Auth Auth } // Load reads configuration from the environment, applies defaults, and validates it. func Load() (Config, error) { // Secret key decode errors are collected and surfaced alongside validation errors, so a // misconfigured deploy sees every problem at once instead of one boot failure at a time. var secretErrs []error getB := func(key string) []byte { b, err := getBytes(key) if err != nil { secretErrs = append(secretErrs, err) } return b } c := Config{ Env: Env(getDefault("MM_ENV", string(EnvDevelopment))), HTTPAddr: getDefault("MM_HTTP_ADDR", ":8080"), Tenancy: Tenancy(getDefault("MM_TENANCY", string(TenancyShared))), AppDatabaseURL: os.Getenv("MM_DATABASE_URL"), MigratorDatabaseURL: os.Getenv("MM_MIGRATOR_DATABASE_URL"), ComplianceDatabaseURL: os.Getenv("MM_COMPLIANCE_DATABASE_URL"), Secrets: Secrets{ Backend: SecretsBackend(getDefault("MM_SECRETS_BACKEND", string(SecretsEnv))), CacheTTLSeconds: getInt("MM_SECRET_CACHE_TTL_SECONDS", 900), }, TenantPools: TenantPools{ MaxPools: getInt("MM_TENANT_MAX_POOLS", 64), MaxConnsPerPool: getInt("MM_TENANT_POOL_MAX_CONNS", 4), IdleEvictSecs: getInt("MM_TENANT_POOL_IDLE_EVICT_SECONDS", 1800), }, DecisionRetentionDays: getInt("MM_DECISION_RETENTION_DAYS", 90), Cloud: Cloud(getDefault("MM_CLOUD", string(CloudLocal))), Embeddings: Embeddings{ Provider: EmbeddingProvider(getDefault("MM_EMBED_PROVIDER", string(ProviderFake))), Endpoint: os.Getenv("MM_EMBED_ENDPOINT"), Model: os.Getenv("MM_EMBED_MODEL"), Dimension: getInt("MM_EMBED_DIMENSION", 384), APIKey: os.Getenv("MM_EMBED_API_KEY"), MegamindURL: os.Getenv("MM_MEGAMIND_URL"), }, Inference: Inference{ URL: os.Getenv("MM_MEGAMIND_URL"), // bge-small-en-v1.5 (384 dim) is the production embedder, served on Ollama as the qllama handle. // Stored and query vectors MUST use the same model: switching the model requires a FULL re // backfill (existing vectors from another model are incompatible), see DEPLOY_PLAN.md. EmbedModel: getDefault("MM_MEGAMIND_EMBED_MODEL", "qllama/bge-small-en-v1.5"), RerankModel: getDefault("MM_MEGAMIND_RERANK_MODEL", "bge-reranker-v2-m3"), GenerateModel: getDefault("MM_MEGAMIND_GENERATE_MODEL", "llama3.1:8b"), Dimension: getInt("MM_EMBED_DIMENSION", 384), TimeoutSeconds: getInt("MM_MEGAMIND_TIMEOUT_SECONDS", 30), MaxRetries: getInt("MM_MEGAMIND_MAX_RETRIES", 2), BreakerTrips: getInt("MM_MEGAMIND_BREAKER_TRIPS", 5), BreakerCoolSec: getInt("MM_MEGAMIND_BREAKER_COOL_SECONDS", 30), TeachingEnabled: getBool("MM_MEGAMIND_TEACHING_ENABLED", false), }, Extraction: Extraction{ Provider: ExtractorProvider(getDefault("MM_EXTRACT_PROVIDER", string(ExtractorDeterministic))), Endpoint: os.Getenv("MM_EXTRACT_ENDPOINT"), Model: os.Getenv("MM_EXTRACT_MODEL"), APIKey: os.Getenv("MM_EXTRACT_API_KEY"), }, RequireFIPS: getBool("MM_REQUIRE_FIPS", false), AllowDevHeaderAuth: getBool("MM_ALLOW_DEV_HEADER_AUTH", false), AllowedOrigins: splitCSV(os.Getenv("MM_ALLOWED_ORIGINS")), TrustedProxyHeader: os.Getenv("MM_TRUSTED_PROXY_HEADER"), Auth: Auth{ PepperVersion: getInt("MM_CREDENTIAL_PEPPER_VERSION", 1), Pepper: getB("MM_CREDENTIAL_PEPPER"), PepperPrevious: getB("MM_CREDENTIAL_PEPPER_PREVIOUS"), TOTPKEKVersion: getInt("MM_TOTP_KEK_VERSION", 1), TOTPKEK: getB("MM_TOTP_KEK"), TOTPKEKPrevious: getB("MM_TOTP_KEK_PREVIOUS"), CSRFKey: getB("MM_CSRF_KEY"), RecoveryLookupKey: getB("MM_RECOVERY_LOOKUP_KEY"), TOTPIssuer: getDefault("MM_TOTP_ISSUER", "missionMATCH"), SessionIdleSeconds: getInt("MM_SESSION_IDLE_SECONDS", 900), SessionAbsoluteSeconds: getInt("MM_SESSION_ABSOLUTE_SECONDS", 43200), PendingAbsoluteSeconds: getInt("MM_SESSION_PENDING_SECONDS", 300), InviteExpirySeconds: getInt("MM_INVITE_EXPIRY_SECONDS", 259200), CookieSecure: getBool("MM_COOKIE_SECURE", true), MFARequired: getBool("MM_MFA_REQUIRED", true), }, } if err := c.Validate(); err != nil { secretErrs = append(secretErrs, err) } if len(secretErrs) > 0 { return Config{}, errors.Join(secretErrs...) } return c, nil } // Validate enforces invariants and environment-specific requirements. Errors are joined so a // misconfigured deploy surfaces every problem at once. func (c Config) Validate() error { var errs []error switch c.Env { case EnvDevelopment, EnvProduction: default: errs = append(errs, fmt.Errorf("MM_ENV %q invalid (want development|production)", c.Env)) } switch c.Cloud { case CloudLocal, CloudAWSGovCloud, CloudAzureGov: default: errs = append(errs, fmt.Errorf("MM_CLOUD %q invalid (want local|aws_govcloud|azure_gov)", c.Cloud)) } // Empty is the zero value of a directly constructed Config and means the default (shared tenancy, env // secrets); Load always fills these explicitly. Only a non empty invalid value is rejected. switch c.Tenancy { case TenancyShared, TenancyPerTenant, "": default: errs = append(errs, fmt.Errorf("MM_TENANCY %q invalid (want shared|per_tenant)", c.Tenancy)) } switch c.Secrets.Backend { case SecretsEnv, SecretsAWSGovCloud, SecretsAzureGov, "": default: errs = append(errs, fmt.Errorf("MM_SECRETS_BACKEND %q invalid (want env|aws_govcloud|azure_gov)", c.Secrets.Backend)) } if c.Tenancy == TenancyPerTenant { // In per tenant mode the AppDatabaseURL is the control plane app DSN; it must be set so identity, // auth, and the tenant directory have a home, and the pool bounds must be sane so the fleet of // tenant pools cannot exhaust the server connection budget. if c.AppDatabaseURL == "" { errs = append(errs, errors.New("MM_DATABASE_URL (the control plane app DSN) required when MM_TENANCY=per_tenant")) } if c.TenantPools.MaxPools <= 0 || c.TenantPools.MaxConnsPerPool <= 0 || c.TenantPools.IdleEvictSecs <= 0 { errs = append(errs, errors.New("MM_TENANT_MAX_POOLS, MM_TENANT_POOL_MAX_CONNS, and MM_TENANT_POOL_IDLE_EVICT_SECONDS must all be positive in per_tenant mode")) } } switch c.Embeddings.Provider { case ProviderFake, ProviderOpenAI, ProviderBedrock, ProviderAzureOpenAI, ProviderMegamind: default: errs = append(errs, fmt.Errorf("MM_EMBED_PROVIDER %q invalid", c.Embeddings.Provider)) } if c.Embeddings.Dimension <= 0 { errs = append(errs, errors.New("MM_EMBED_DIMENSION must be > 0")) } // Empty selects the deterministic extractor (the same default extraction.New applies), so a Config // built without an explicit provider validates. switch c.Extraction.Provider { case ExtractorDeterministic, "": default: errs = append(errs, fmt.Errorf("MM_EXTRACT_PROVIDER %q invalid (want deterministic)", c.Extraction.Provider)) } // OpenAI-compatible providers need an endpoint + model. if c.Embeddings.Provider == ProviderOpenAI || c.Embeddings.Provider == ProviderAzureOpenAI { if c.Embeddings.Endpoint == "" { errs = append(errs, fmt.Errorf("MM_EMBED_ENDPOINT required for provider %q", c.Embeddings.Provider)) } if c.Embeddings.Model == "" { errs = append(errs, fmt.Errorf("MM_EMBED_MODEL required for provider %q", c.Embeddings.Provider)) } } // The MEGAMIND provider needs the gateway URL and the embed model name. if c.Embeddings.Provider == ProviderMegamind { if c.Embeddings.MegamindURL == "" { errs = append(errs, errors.New("MM_MEGAMIND_URL required for provider \"megamind\"")) } if c.Embeddings.Model == "" && c.Inference.EmbedModel == "" { errs = append(errs, errors.New("MM_EMBED_MODEL or MM_MEGAMIND_EMBED_MODEL required for provider \"megamind\"")) } } // TOTP secrets are AES 256, so the KEK must be exactly 32 bytes whenever it is set, in any env. if len(c.Auth.TOTPKEK) != 0 && len(c.Auth.TOTPKEK) != 32 { errs = append(errs, errors.New("MM_TOTP_KEK must decode to exactly 32 bytes (AES 256)")) } if len(c.Auth.TOTPKEKPrevious) != 0 && len(c.Auth.TOTPKEKPrevious) != 32 { errs = append(errs, errors.New("MM_TOTP_KEK_PREVIOUS must decode to exactly 32 bytes (AES 256)")) } if c.Auth.PepperVersion <= 0 { errs = append(errs, errors.New("MM_CREDENTIAL_PEPPER_VERSION must be positive")) } if c.Auth.SessionIdleSeconds <= 0 || c.Auth.SessionAbsoluteSeconds <= 0 || c.Auth.PendingAbsoluteSeconds <= 0 { errs = append(errs, errors.New("session timeout seconds must all be positive")) } if c.DecisionRetentionDays <= 0 { errs = append(errs, errors.New("MM_DECISION_RETENTION_DAYS must be positive")) } if c.Env == EnvProduction { if c.AppDatabaseURL == "" { errs = append(errs, errors.New("MM_DATABASE_URL required in production")) } if c.Embeddings.Provider == ProviderFake { errs = append(errs, errors.New("the fake embedding provider must not be used in production")) } if c.Cloud == CloudLocal { errs = append(errs, errors.New("MM_CLOUD must be a government cloud in production")) } // In production the per tenant credentials must come from a managed secret store, never the env // file backend (that is the dev and staging convenience). The cloud adapter is wired at deploy. if c.Tenancy == TenancyPerTenant && c.Secrets.Backend == SecretsEnv { errs = append(errs, errors.New("MM_SECRETS_BACKEND must be a government cloud secret store in production per_tenant mode, not env")) } // The dev X-Org-ID resolver may never be the production tenant source. if c.AllowDevHeaderAuth { errs = append(errs, errors.New("MM_ALLOW_DEV_HEADER_AUTH must be false in production")) } // FIPS must be enforced, not optional, so the validated crypto path is the one that runs. if !c.RequireFIPS { errs = append(errs, errors.New("MM_REQUIRE_FIPS must be true in production")) } // Every auth secret must be present so the validated crypto has its keys. if len(c.Auth.Pepper) == 0 { errs = append(errs, errors.New("MM_CREDENTIAL_PEPPER required in production")) } if len(c.Auth.TOTPKEK) != 32 { errs = append(errs, errors.New("MM_TOTP_KEK (32 byte AES 256 key) required in production")) } if len(c.Auth.CSRFKey) == 0 { errs = append(errs, errors.New("MM_CSRF_KEY required in production")) } if len(c.Auth.RecoveryLookupKey) == 0 { errs = append(errs, errors.New("MM_RECOVERY_LOOKUP_KEY required in production")) } // The CSRF Origin allowlist must be enforced; an empty list disables it (a dev only path). if len(c.AllowedOrigins) == 0 { errs = append(errs, errors.New("MM_ALLOWED_ORIGINS required in production (the CSRF Origin allowlist must be enforced)")) } // Both cookies use the __Host- prefix, which a browser only accepts when Secure is set; a non // Secure production deploy silently breaks all auth and exposes the token. if !c.Auth.CookieSecure { errs = append(errs, errors.New("MM_COOKIE_SECURE must be true in production (the __Host- cookie prefix requires Secure)")) } // MFA is mandatory in production. The pilot only password only relaxation can never ship to a // government cloud, so a production deploy with it set is a hard configuration error. if !c.Auth.MFARequired { errs = append(errs, errors.New("MM_MFA_REQUIRED must be true in production (MFA is mandatory)")) } } return errors.Join(errs...) } // IsProduction reports whether this is a production deployment. func (c Config) IsProduction() bool { return c.Env == EnvProduction } func getDefault(key, def string) string { if v := strings.TrimSpace(os.Getenv(key)); v != "" { return v } return def } func getInt(key string, def int) int { if v := strings.TrimSpace(os.Getenv(key)); v != "" { if n, err := strconv.Atoi(v); err == nil { return n } } return def } func getBool(key string, def bool) bool { if v := strings.TrimSpace(os.Getenv(key)); v != "" { if b, err := strconv.ParseBool(v); err == nil { return b } } return def } // splitCSV splits a comma separated env value into trimmed, non empty entries. func splitCSV(v string) []string { if strings.TrimSpace(v) == "" { return nil } parts := strings.Split(v, ",") out := make([]string, 0, len(parts)) for _, p := range parts { if t := strings.TrimSpace(p); t != "" { out = append(out, t) } } return out } // getBytes loads a secret key from the environment using an EXPLICIT encoding prefix so the key // material is never ambiguous: "base64:", "hex:", or "raw:". A bare value (no prefix) is decoded as // standard base64, and a decode failure is a hard error rather than a silent fall back to the raw // string. The silent fall back was a real footgun: a passphrase that happens to be valid base64 would // be decoded to different bytes than the operator intended, so the same variable could mean two // different keys in two contexts (a TOTP KEK that no longer decrypts its secrets, a pepper that no // longer verifies its passwords). Forcing the operator to declare the encoding removes that class of // bug. An unset variable yields nil with no error. func getBytes(key string) ([]byte, error) { v := strings.TrimSpace(os.Getenv(key)) if v == "" { return nil, nil } switch { case strings.HasPrefix(v, "raw:"): return []byte(strings.TrimPrefix(v, "raw:")), nil case strings.HasPrefix(v, "hex:"): b, err := hex.DecodeString(strings.TrimPrefix(v, "hex:")) if err != nil { return nil, fmt.Errorf("%s: invalid hex value: %w", key, err) } return b, nil case strings.HasPrefix(v, "base64:"): b, err := base64.StdEncoding.DecodeString(strings.TrimPrefix(v, "base64:")) if err != nil { return nil, fmt.Errorf("%s: invalid base64 value: %w", key, err) } return b, nil default: b, err := base64.StdEncoding.DecodeString(v) if err != nil { return nil, fmt.Errorf("%s: value must be base64, or carry a raw: / hex: / base64: prefix: %w", key, err) } return b, nil } }

Search equations, builds, manuscript text, and recovered sources.