Bref Internal Events for Loading Environment Variables #1929
Unanswered
mattsbanner
asked this question in
Support
Replies: 1 comment
-
It's worth noting that even when using the |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi
We’re running several Laravel services with Bref and are on the 4KB environment variable limit. To work around this, we’ve developed a package that loads a single SecretsManager secret (key/value) and parses the pairs into environment variables - resulting in a single API call that theoretically allows an additional 64KB of variables. This is cached in the same way as brefphp/secrets-loader. I'm not sure I can make our repository public, but we’re using a Composer autoloader file to subscribe, similar to mnapoli/sqlite-s3.
Where is best to trigger this? The
beforeStartup
event seems ideal since it runs right after Bref loads from Parameter Store. However, since this appears to be an undocumented/internal API, we’re cautious about its stability.Calling the secrets loader within a handler is another option, but we’re concerned that some environment variables might be needed before the handler executes - though likely only those used internally by Bref.
Given that Bref’s code marks EventSubscribers as experimental and unstable, would you recommend using them for this, or is it safer to load secrets within the handler while keeping any non-application environment variables in Lambda?
Appreciate any guidance!
Beta Was this translation helpful? Give feedback.
All reactions