Skip to content

refactor(env): move Constructive runtime config ownership out of PGPM#1371

Draft
Zetazzz wants to merge 1 commit into
mainfrom
refactor/env-ownership
Draft

refactor(env): move Constructive runtime config ownership out of PGPM#1371
Zetazzz wants to merge 1 commit into
mainfrom
refactor/env-ownership

Conversation

@Zetazzz

@Zetazzz Zetazzz commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

Summary

This PR corrects the ownership boundary between the lower-level PGPM configuration packages and the upper-level Constructive GraphQL configuration packages.

  • Moves existing server, CDN/storage, jobs, and SMTP types and defaults from @pgpmjs/types to @constructive-io/graphql-types.
  • Moves the corresponding environment-variable parsing and getNodeEnv() from @pgpmjs/env to @constructive-io/graphql-env.
  • Adds a PGPM-only projection so Constructive sections cannot leak into pure PGPM results through config files or runtime overrides.
  • Keeps ConstructiveOptions as the aggregate configuration model on top of PgpmOptions.
  • Updates directly affected jobs, SMTP, storage, explorer, and GraphQL server consumers.

Why

@pgpmjs/env and @pgpmjs/types should describe PostgreSQL and the PGPM toolchain rather than application-runtime concerns. Server, storage, jobs, and SMTP settings belong to the upper Constructive configuration layer.

This reduces PGPM coupling while preserving one complete configuration entry point for Constructive applications.

Behavior and API impact

  • getPgpmEnvOptions() returns only PGPM-owned configuration.
  • getEnvOptions remains the exact alias of getPgpmEnvOptions in @pgpmjs/env.
  • getConstructiveEnvOptions() continues to return both PGPM and Constructive runtime configuration.
  • getEnvOptions remains the exact alias of getConstructiveEnvOptions in @constructive-io/graphql-env.
  • Existing variable names, conversion behavior, defaults, configuration structure, and AWS credential alias precedence are retained.
  • Constructive resolution order remains: defaults → PGPM config/env → Constructive config → Constructive env → runtime overrides.
  • Arrays continue to use replacement semantics.
  • Moved PGPM types are intentionally not compatibility-re-exported. Affected repository consumers now import them from @constructive-io/graphql-types.

Validation

Updated tests cover:

  • exact resolver alias identity;
  • exclusion of Constructive sections from PGPM results;
  • config-file and override boundary enforcement;
  • parsing of moved server, CDN/storage, jobs, and SMTP variables;
  • AWS environment alias fallback order;
  • preservation of Constructive defaults and merge precedence;
  • array replacement behavior.

Affected PGPM, GraphQL, jobs, SMTP, storage, explorer, and GraphQL server packages build successfully. PGPM env, GraphQL env, SMTP, and GraphQL server test suites pass, along with frozen-lockfile and diff checks.

Out of scope

This PR does not include the generic parser follow-up. It does not extract or centralize the permissive boolean, number, or string-array helpers into 12factor-env/parsers.

It also does not consolidate environment variables owned by Mailgun providers, individual functions, Knative runtimes, LLM integrations, observability, CAPTCHA, Graphile runtime helpers, or test harnesses.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant