Resolve the active database platform from an environment variable.
Strict — only the canonical DatabasePlatform values ('sqlserver',
'postgresql', case-insensitive) are recognized. An unset, empty, or
whitespace-only variable returns undefined, letting the caller pick a
default. Any other non-empty value (typos, legacy aliases like mssql /
postgres / pg, unsupported dialects) throws — silent fallback is the
bug we don't want, because it routes the wrong provider at the wrong
dialect against a real database.
Lives in @memberjunction/generic-database-provider (server-only) rather
than @memberjunction/core or @memberjunction/global because the
process.* API is Node-specific and those two packages are imported by
client-side code paths. This is the first server-only package in the dep
chain, so it's the right home for env-var parsing.
Parameters
envVarName: string = 'DB_PLATFORM'
Name of the env var to read. Defaults to DB_PLATFORM.
The legacy DB_TYPE name is no longer consulted; rename your .env.
Resolve the active database platform from an environment variable.
Strict — only the canonical DatabasePlatform values (
'sqlserver','postgresql', case-insensitive) are recognized. An unset, empty, or whitespace-only variable returnsundefined, letting the caller pick a default. Any other non-empty value (typos, legacy aliases likemssql/postgres/pg, unsupported dialects) throws — silent fallback is the bug we don't want, because it routes the wrong provider at the wrong dialect against a real database.Lives in
@memberjunction/generic-database-provider(server-only) rather than@memberjunction/coreor@memberjunction/globalbecause theprocess.*API is Node-specific and those two packages are imported by client-side code paths. This is the first server-only package in the dep chain, so it's the right home for env-var parsing.