Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Load .env on app init #2125

Merged
merged 1 commit into from Dec 14, 2019
Merged

Load .env on app init #2125

merged 1 commit into from Dec 14, 2019

Conversation

@tanner0101
Copy link
Member

tanner0101 commented Dec 14, 2019

Environment variables loaded from .env files can now be accessed immediately after Application has initialized.

.env (in same folder as Package.swift)

FOO=BAR

main.swift

let app = Application(...)
defer { app.shutdown() } 

let foo = Environment.get("FOO") 
print(foo) // BAR
@tanner0101 tanner0101 added the bug label Dec 14, 2019
@tanner0101 tanner0101 added this to In Progress in Vapor 4 via automation Dec 14, 2019
@tanner0101 tanner0101 merged commit a593dce into master Dec 14, 2019
2 checks passed
2 checks passed
xenial
Details
bionic
Details
Vapor 4 automation moved this from In Progress to Done Dec 14, 2019
@tanner0101

This comment has been minimized.

Copy link
Member Author

tanner0101 commented Dec 14, 2019

These changes are now available in 4.0.0-beta.2.2

@tanner0101 tanner0101 deleted the tn-loadenv branch Dec 14, 2019
@tanner0101 tanner0101 mentioned this pull request Dec 14, 2019
@MrLotU MrLotU mentioned this pull request Dec 14, 2019
4 of 4 tasks complete
kaishin added a commit to kaishin/vapor that referenced this pull request Jan 9, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Vapor 4
  
Done
Linked issues

Successfully merging this pull request may close these issues.

None yet

1 participant
You can’t perform that action at this time.