Comments (9)
Thank you, I have made the suggested change and this workaround is working as expected.
from serverless-dotenv-plugin.
Thanks @neverendingqs !
from serverless-dotenv-plugin.
The library passes all values to dotenv-expand
: https://github.com/colynb/serverless-dotenv-plugin/blob/79d8ad4b182bff3e11b62bf7fd80ba5485c2e05f/index.js#L74. dotenv-expand
sees $456
as a variable to look up and replaces $456
with its value (in your case, it looks like it's replacing it with the empty string).
It looks like dotenv-expand
doesn't like !
, so it stops there.
You can see this in action with the following .env
file:
456=HI
TEST_1=123$456!@#%^&*()
TEST_1
will become 123HI!@#%^&*()
.
To work around this, you can use \
to escape $
(based on https://github.com/motdotla/dotenv-expand/blob/master/test/.env#L7) and my tests with the following .env
file:
TEST_1=123\$456!@#%^&*()
from serverless-dotenv-plugin.
This might be another reason to try to get #48 merged. This will allow users to choose to bypass the dotenv-expand
functionality.
from serverless-dotenv-plugin.
@neverendingqs, @colynb The workaround is not working for me.
For the input value of
TEST="8k73fe1CDu4a%3v7FJR%&o61KHf@w!!3t8NJTdT%jn\$iSRIP^9J6pzf3P4Ulfjaw"
The output is
process.env.TEST="8k73fe1CDu4a%3v7FJR%&o61KHf@w!!3t8NJTdT%jn^9J6pzf3P4Ulfjaw"
It still replaces the $iSRIP part with an empty string.
I have tried with single/double/without quotes.
Package version 3.1.0
from serverless-dotenv-plugin.
FYI [email protected]
introduced #116, which allows you to turn off this behaviour.
from serverless-dotenv-plugin.
@neverendingqs the workaround didn't work for me either, I'm using [email protected]
, where do we can turn-off that behaviour?
from serverless-dotenv-plugin.
Hi @94marianag,
Please see the linked pull request or the main README for details.
from serverless-dotenv-plugin.
Thank you, it worked perfect!!
from serverless-dotenv-plugin.
Related Issues (20)
- Plugin should throw on error.
- Release GitHub action workflow only works if there is no branch protection. HOT 1
- Warn when incompatible options are set
- Automatic env file resolution is in reverse order of precedence HOT 7
- Create npmignore file
- Release (next)
- Consider how new variables engine in serverless could improve or impact this plugin HOT 2
- Document differences between Serverless's .env resolution and this plugin HOT 1
- NODE_ENV and stage collides to each other HOT 3
- System environment variables (wrongly) take higher precedence than the .env file HOT 7
- Cannot have parameterized `stage` and `region` HOT 2
- Serverless Framework v3: integrating with the new design
- Can't read multi line env variable - v2.62.0 HOT 2
- Not loading env file from stage param HOT 3
- basePath not getting resolve HOT 3
- Allow ability to set default environment name. HOT 2
- Feature Request: Add `envFile` to configuration.
- Question : setting env var HOT 1
- Fix links in package.json
- Add a pull request template
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from serverless-dotenv-plugin.