1
0
Fork 0

Document Spring preloader issue and workaround (#14)

This commit is contained in:
Andrew Tomaka 2019-11-13 22:18:02 -05:00 committed by GitHub
parent e4eadd59a8
commit 0d9fabbbb0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 21 additions and 1 deletions

View File

@ -4,7 +4,7 @@
Shim to load environment variables from [AWS Systems Manager Parameter Store](https://aws.amazon.com/systems-manager/features/#Parameter_Store) into ENV.
Psenv currently heavily borrows from [Dotenv](https://github.com/bkeepers/dotenv), mainly because I use it in roughly every project so it made since for the APIs to match.
Psenv currently heavily borrows from [Dotenv](https://github.com/bkeepers/dotenv), mainly because I use it in roughly every project so it made sense for the APIs to match.
## Installation
@ -23,6 +23,26 @@ And then execute:
Set the `PARAMETER_STORE_PATH` environment variable with the AWS Parameter
Store path that you wish to load.
#### Spring preloader
The Spring preloader does not detect environment variable changes as
application changes. This means that when using Spring, new or changed
environment variables from AWS SSM Parameter Store will not become available
immediately. This also applies to any change to `PARAMETER_STORE_PATH`.
There are two work-arounds. You can force Spring to restart by killing it with
`bundle exec spring stop`.
Alternatively, you can update your Spring configuration to reload variables
using Psenv after the process forks. To do this, add the following configuration
to `config/spring.rb`:
```
Spring.after_fork do
Psenv.load
end
```
### Plain Ruby
Add this line to your application's Gemfile: