Giter Club home page Giter Club logo

Comments (9)

nishabe avatar nishabe commented on July 27, 2024 2

Thank you, I have made the suggested change and this workaround is working as expected.

from serverless-dotenv-plugin.

colynb avatar colynb commented on July 27, 2024 1

Thanks @neverendingqs !

from serverless-dotenv-plugin.

neverendingqs avatar neverendingqs commented on July 27, 2024

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.

neverendingqs avatar neverendingqs commented on July 27, 2024

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.

Arattian avatar Arattian commented on July 27, 2024

@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.

neverendingqs avatar neverendingqs commented on July 27, 2024

FYI [email protected] introduced #116, which allows you to turn off this behaviour.

from serverless-dotenv-plugin.

94marianag avatar 94marianag commented on July 27, 2024

@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.

neverendingqs avatar neverendingqs commented on July 27, 2024

Hi @94marianag,

Please see the linked pull request or the main README for details.

from serverless-dotenv-plugin.

94marianag avatar 94marianag commented on July 27, 2024

Thank you, it worked perfect!!

from serverless-dotenv-plugin.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.