Skip to main content
Version: v0.1.1

Configuration

Labkit configuration helpers read values from small interfaces. They do not own a secrets provider, deployment platform, or app-specific config class.

Shared Parsing​

@omgjs/labkit-runtime-config parses primitive strings:

parseBoolean("true", false);
parseNumber("3000", 8080);
parseFiniteNumber("15000", 30000, { min: 0 });
parseList("http://localhost:5173,https://app.example.com");

These helpers accept values passed into them. They do not read process.env or import.meta.env directly.

Server Reader​

@omgjs/labkit-server-config defines a ConfigReader compatible with Nest ConfigService:

type ConfigReader = {
get<T = string>(key: string): T | undefined;
};

Use createEnvironmentConfigReader(process.env) outside Nest, or pass ConfigService inside a Nest app.

Common Server Keys​

KeyUsed byDefault
HOSTreadServerRuntimeOptions0.0.0.0
PORTreadServerRuntimeOptions3000
GRAPHQL_PATHserver GraphQL helpers/graphql
PUBSUB_DRIVERapp runtime selectionmemory
CORS_ORIGINreadServerCorsOptions*
AUTH_REFRESH_TOKEN_TRANSPORTserver/browser auth alignmentcookie
AUTH_REFRESH_COOKIE_NAMEapp config reader for server authapp-owned
AUTH_REFRESH_COOKIE_PATHapp config reader for server authapp-owned
AUTH_REFRESH_COOKIE_SAME_SITEapp config reader for server authapp-owned
AUTH_REFRESH_COOKIE_SECUREapp config reader for server authapp-owned

readServerCorsOptions enables credentials automatically unless refresh tokens are transported in the response body.

Browser Build Values​

The browser should keep endpoint resolution app-owned. A common Vite shape:

const HTTP_CONFIG = import.meta.env.VITE_GRAPHQL_HTTP!;
const WS_CONFIG = import.meta.env.VITE_GRAPHQL_WS!;

Use @omgjs/labkit-webapp-build-config in vite.config.ts to fail production builds when required endpoint variables are missing.

Runtime Rule​

Configuration docs belong with the runtime they affect. Labkit docs should explain which values change auth, GraphQL, database, and browser behavior. Provider-specific deployment setup belongs to the application or Rush Delivery documentation.