Skip to content

Add an application environment resolved from APP_ENV through recognized aliases. - #18

Merged
gustavofreze merged 1 commit into
mainfrom
feat/application-environment
Nov 4, 2026
Merged

gustavofreze merged 1 commit into
mainfrom
feat/application-environment

Conversation

@gustavofreze

Copy link
Copy Markdown
Member

Please follow the contributing guidelines.

Summary

  • Adds the ApplicationEnvironment backed enum with the LOCAL, TEST, DEVELOPMENT, STAGING, and PRODUCTION cases, so a consumer asks isLocal() instead of comparing APP_ENV to a raw string.
  • Adds ApplicationEnvironment::current(), which reads APP_ENV through EnvironmentVariable::from, so the same resolution order and the HTTP_ guard apply and a missing variable still raises EnvironmentVariableMissing.
  • Adds ApplicationEnvironment::fromAlias(), matching aliases regardless of casing and of surrounding whitespace: local and localhost, test and testing, development, dev, and develop, staging, stage, homolog, and homologation, production and prod.
  • Adds ApplicationEnvironmentUnrecognized, raised for a value no environment recognizes, with the accepted aliases in its message.
  • Adds the isLocal(), isTest(), isDevelopment(), isStaging(), and isProduction() predicates, plus aliases().
  • Documents the new section, the exception, and the no-fallback decision in the README.

The existing API is unchanged.

Related issue

None.

Checklist

  • Tests added or updated.
  • Documentation updated when applicable.
  • make review passes.
  • make tests passes.

@gustavofreze
gustavofreze merged commit 6597cd9 into main Nov 4, 2026
5 checks passed
@gustavofreze
gustavofreze deleted the feat/application-environment branch November 4, 2026 12:48
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