Skip to content

`Environment` cleanups

Compare
Choose a tag to compare
@tanner0101 tanner0101 released this 26 May 17:27
a049aff
This patch was authored and released by @gwynne.
  • Clean up Environment's implementation.

  • Add the ability to specify the application environment using the environment variable VAPOR_ENV (partial implementation of #2333). If both VAPOR_ENV and --env are provided, the latter always takes precedence.

  • Environment now recognizes and strips the spurious arguments Xcode passes to test runners when a scheme doesn't specify any arguments of its own. It will do this especially specifically for the testing environment, which is often explicitly specified to Application's initializers instead of .detect() in unit tests. This behavior is only enabled when building in Xcode or with xcodebuild. This negates the need to explicitly override the input arguments in the non-production presets, meaning command line arguments no longer occasionally seem to vanish into thin air in certain cases.

  • Redo the documentation comments for both versions of Environment.secret() and significantly simplify the implementation. Important: This is an interim cleanup step pending a complete revamp of the secret() API.

Note: Pains have been taken not to change the observable behavior of any public APIs and to remain otherwise behaviorally consistent. The addition of VAPOR_ENV counts as new public API and thus drives this being a semver-minor change, but in all other respects it should have no visible effect.