-
Notifications
You must be signed in to change notification settings - Fork 30
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
Access Parameter store config locally via Dotenv #4745
Conversation
Size Change: -944 B (0%) Total Size: 1.68 MB
ℹ️ View Unchanged
|
159af6c
to
523f13b
Compare
⚡️ Lighthouse report for the changes in this PRLighthouse tested 2 URLs Report for Article
Report for Front
|
fab115d
to
86d695d
Compare
0dcae01
to
9bbbf58
Compare
|
||
### Lines in the sand | ||
|
||
#### `.env` shouldn't be required |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1 An important point not to be forgotten
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you think it's worth enforcing in some or other way? That might be how we access to config is the only way I can think of.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks really good!
Should we document somewhere how this all works, and I think an important thing to cover is that right now we only pass our .env variables into the server build - meaning that they're not available on the client.
It's important that if that were to ever change appropriate considerations were taking (like requiring a CLIENT_
prefix) to avoid any accidental security leaks.
@@ -0,0 +1,81 @@ | |||
const { CredentialsProviderError } = require('@aws-sdk/property-provider'); | |||
const path = require('path'); | |||
const { prompt, log, warn } = require('../env/log'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I personally don't like the colours in this library, but at least using it will make things consistent.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't actually know this library existed! Are there some other places we should be using it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It’s been there … a while #80 😆
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why are we using floating promises and commonJS?
- All the file system APIs now exist as synchronous methods.
- top-level await is supported since node 13
- ES modules are enabled by default since node 14 (using .mjs)
Co-authored-by: Olly <9575458+OllysCoding@users.noreply.github.com>
…ring into server-side-dotenv
@mxdvl "floating promises" Could you point this out - if you're talking about in "common-js" <- same it was just copy/paste. @OllysCoding nice idea, I'll add an ADR. |
3bd6f1b
to
3c74346
Compare
Co-authored-by: Ioanna Kokkini <ioannakok@users.noreply.github.com>
Part of #4823
Generates a
.env
file from parameter store as part of ourmake dev
command.gen-dotenv
has been added to thebuild
,build-ci
anddev
targets as it is only needed when running the server and is a file that is part of the build.I've added a check to the see if we're running
NODE_ENV=production
to fail if the file cannot be generated, and then set that for the general targetsbuild
andbuild-ci
rather than just when running the node script..env
Dev messaging
Co-authored-by: Olly Namey olly.namey@guardian.co.uk
Co-authored-by: Ash Carr ashleigh.carr@guardian.co.uk
Co-authored-by: Ioanna Kokkini ioanna.kokkini@guardian.co.uk