Multi-line env variables #1

Closed
opened 2022-01-07 07:44:31 +00:00 by axelson · 6 comments
axelson commented 2022-01-07 07:44:31 +00:00 (Migrated from gitlab.com)

First off, thanks for this library! It is working great in my testing so far!

Is it possible to have multi-line env variables? Where there is a literal newline in the file? Although I suppose it isn't truly needed because you can use \n to encode it.

First off, thanks for this library! It is working great in my testing so far! Is it possible to have multi-line env variables? Where there is a literal newline in the file? Although I suppose it isn't truly needed because you can use `\n` to encode it.

Good idea! But how would you encode it in the file, besides \n?

FOO="val
continues
maybe"

# Or heredoc (cut out first and last linebreaks)?

FOO="""
val
continues
maybe
"""
Good idea! But how would you encode it in the file, besides `\n`? ``` FOO="val continues maybe" # Or heredoc (cut out first and last linebreaks)? FOO=""" val continues maybe """ ```
axelson commented 2022-01-07 15:43:45 +00:00 (Migrated from gitlab.com)

That first option is exactly what I was thinking, and I think of the two it would be the better option because it would be a more general encoding. Using a heredoc feels a little too Elixir specific.

That first option is exactly what I was thinking, and I think of the two it would be the better option because it would be a more general encoding. Using a heredoc feels a little too Elixir specific.

Here's another example:

FOO=val\
continues\
maybe

What I'm worried about is complicating the parser too much. Currently it's very simple since it can go line-by-line.

Here's another example: ``` FOO=val\ continues\ maybe ``` What I'm worried about is complicating the parser too much. Currently it's very simple since it can go line-by-line.

BTW heredocs are familiar to me from PHP. Maybe we should use that style. 😄

FOO=<<<val
continues
maybe
<<<FOO;

Triple quotes would be also how to do it in Python, so it doesn't feel too Elixir specific to me.

BTW heredocs are familiar to me from PHP. Maybe we should use that style. :smile: ``` FOO=<<<val continues maybe <<<FOO; ``` Triple quotes would be also how to do it in Python, so it doesn't feel too Elixir specific to me.

mentioned in merge request !1

mentioned in merge request !1

mentioned in commit 735e1867f6

mentioned in commit 735e1867f69d94da8abb68ad283a766a7c2efa56
nicd closed this issue 2022-01-28 18:11:54 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: nicd/dotenv-parser#1
No description provided.