Timeline for Access "variable" environment variable using dynamic javascript variable names
Current License: CC BY-SA 4.0
Post Revisions
19 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Nov 11, 2021 at 18:58 | comment | added | thpo |
process.env['BASIC_PRICE_' + iso_code_uppercase + '_PRODUCT'] should work on the server, so you might want to fetch it.
|
|
| Jun 4, 2019 at 10:54 | answer | added | Suresh Kumar | timeline score: -3 | |
| Mar 7, 2019 at 8:25 | history | reopened |
Sebastian Simon gdlmx Tyl Treycos Matteo Baldi |
||
| Mar 7, 2019 at 1:10 | review | Reopen votes | |||
| Mar 7, 2019 at 8:25 | |||||
| Mar 6, 2019 at 20:17 | comment | added | dkershaw | UPDATE: looks like there's a webpack fix in progress: github.com/webpack/webpack/pull/8721 | |
| Mar 6, 2019 at 20:02 | comment | added | dkershaw |
This is not a duplicate as it seems to be an issue specific to dynamically accessing process.env variables, as noted by @Xufox
|
|
| Jan 14, 2019 at 23:30 | review | Reopen votes | |||
| Jan 15, 2019 at 6:21 | |||||
| Jan 14, 2019 at 23:29 | comment | added | Mathieu | @Xufox but i think you're right, the issue must be on webpack process.env and bug with statically xpressions, i added a "webpack" tag on my question | |
| Jan 14, 2019 at 23:23 | history | edited | Mathieu |
edited tags
|
|
| Jan 14, 2019 at 23:23 | comment | added | Mathieu | @Xufox, i'll try to find another solution as this was given as example, i might have 200 to group and very hard to maintain on each new country/prices. I wanted to reach "dynamically" the environment variables set. | |
| Jan 14, 2019 at 23:20 | comment | added | Sebastian Simon |
Does it work if you group all six variables in a single object, e.g. PRODUCT_PRICES, then use process.env.PRODUCT_PRICES["BASIC_PRICE_" + current_country_iso_code_uppercase + "_PRODUCT"]? Apparently process.env is a bit... "special".
|
|
| Jan 14, 2019 at 23:14 | comment | added | Mathieu | @Xufox did not work, see my edits | |
| Jan 14, 2019 at 23:11 | history | edited | Mathieu | CC BY-SA 4.0 |
added 402 characters in body
|
| Jan 14, 2019 at 22:33 | comment | added | Mathieu | @Xufox i'll try now, no i haven't, i tried some circumvented/complex stuff ...why didn't i think of it? will update if it works | |
| Jan 14, 2019 at 22:33 | history | closed |
Sebastian Simon Derek Pollard Phil javascript Users with the javascript badge or a synonym can single-handedly close javascript questions as duplicates and reopen them as needed. |
Duplicate of Accessing an object property with a dynamically-computed name | |
| Jan 14, 2019 at 22:31 | comment | added | Sebastian Simon |
Have you tried process.env["BASIC_PRICE_" + current_country_iso_code_uppercase + "_PRODUCT"]?
|
|
| Jan 14, 2019 at 22:31 | history | edited | Mathieu | CC BY-SA 4.0 |
added 51 characters in body
|
| Jan 14, 2019 at 22:31 | answer | added | Marco | timeline score: 21 | |
| Jan 14, 2019 at 22:28 | history | asked | Mathieu | CC BY-SA 4.0 |