-
HI PDK community, I'm trying to load env files to populate some CDK variables related to different environments (AWS account and AWS profile). I looked at https://nx.dev/recipes/tips-n-tricks/define-environment-variables and it looks great but I don't understand why when i try to run a target with NX, it don't see the configuration part:
In that scenario I want NX to load if i add theses lines at the start of the
I have output
Any idea with NX can't find the configuration ? |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 5 replies
-
Have you tried .env.synth.dev ?Please note: My working hours may not be your working hours. Please do not feel obligated to reply outside of your normal work schedule!Sent on the go - please excuse mistakes On 4 Dec 2023, at 8:18 pm, Vale ***@***.***> wrote:
HI PDK community,
I'm trying to load env files to populate some CDK variables related to different environments (AWS account and AWS profile).
I looked at https://nx.dev/recipes/tips-n-tricks/define-environment-variables and it looks great but I don't understand why when i try to run a target with NX, it don't see the configuration part:
pdk nx run infra:synth:dev or pdk nx run infra:synth --configuration dev
In that scenario I want NX to load .env.dev (env specific vars), then .env (common vars) but i can't find the .env.dev
If I rename the .env.dev to .env.synth, this time it worked
if i add theses lines at the start of the main.ts in infra package
console.log(process.env.NX_TASK_TARGET_PROJECT)
console.log(process.env.NX_TASK_TARGET_TARGET)
console.log(process.env.NX_TASK_TARGET_CONFIGURATION)
I have output
infra
synth
undefined
Any idea with NX can't find the configuration ?
—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you are subscribed to this thread.Message ID: ***@***.***>
|
Beta Was this translation helpful? Give feedback.
-
I don't know if for the configuration to be recognize it hat to be in project.json, if yes how can i tell to nx monorepo that there are dev, test, stage and prod configurations in project.json, because there is no way to define configuration in the |
Beta Was this translation helpful? Give feedback.
-
Hi - before I dig deeper into this, have you seen this reference: https://nx.dev/recipes/tips-n-tricks/define-environment-variables ? If you want configuration for a |
Beta Was this translation helpful? Give feedback.
Gotcha,
The reason this is undefined is probably because you haven't specified a dev configuration for your build task. To do that you can do this: