Commit graph

13 commits

Author SHA1 Message Date
Augustin Mauroy
64d9b7c5f8
util: fix parseEnv handling of invalid lines
PR-URL: https://github.com/nodejs/node/pull/57798
Fixes: https://github.com/nodejs/node/issues/56775
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com>
2025-04-21 06:46:44 +00:00
Dario Piotrowicz
cc7018ec51
test: remove unnecessary assert requiring from tests
PR-URL: https://github.com/nodejs/node/pull/57008
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
Reviewed-By: Michael Dawson <midawson@redhat.com>
2025-02-14 17:19:20 +00:00
Dario Piotrowicz
43ffcf1d2e
src: improve node::Dotenv trimming
the trimming functionality that the dotenv parsing uses currently
only takes into consideration plain spaces (' '), other type of
space characters such as tabs and newlines are not trimmed, this
can cause subtle bugs, so the changes here make sure that such
characters get trimmed as well

Co-authored-by: Yagiz Nizipli <yagiz@nizipli.com>
PR-URL: https://github.com/nodejs/node/pull/56983
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2025-02-11 22:26:51 +00:00
Jonas
01a5aa2ac1
test: add missing test for env file
PR-URL: https://github.com/nodejs/node/pull/56642
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Jake Yuesong Li <jake.yuesong@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2025-01-24 16:22:54 +00:00
Shima Ryuhei
3bb1d28499
src: safely remove the last line from dotenv
Refs: https://github.com/nodejs/node/issues/55925
PR-URL: https://github.com/nodejs/node/pull/55982
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
Reviewed-By: Richard Lau <rlau@redhat.com>
Reviewed-By: Juan José Arboleda <soyjuanarbol@gmail.com>
2024-11-26 10:12:50 +00:00
Bosco Domingo
53ede878a5
src: add --env-file-if-exists flag
Fixes: https://github.com/nodejs/node/issues/50993
Refs: https://github.com/nodejs/node/issues/51451

test: remove unnecessary comment

src: conform to style guidelines

src: change flag to `--env-file-optional`

test: revert automatic linter changes

doc: fix typos

src: change flag to `--env-file-if-exists`

src: refactor `env_file_data` and `GetEnvFileDataFromArgs`

test: clean up tests

src: print error when file not found

test: remove unnecessary extras
PR-URL: https://github.com/nodejs/node/pull/53060
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
2024-09-16 00:58:16 +00:00
Aviv Keller
880c446d95
src: don't match after -- in Dotenv::GetPathFromArgs
Co-Authored-By: Cedric Staniewski <cedric@gmx.ca>
PR-URL: https://github.com/nodejs/node/pull/54237
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
2024-08-13 23:56:56 +00:00
IlyasShabi
3f88e149a9
src: remove regex usage for env file parsing
PR-URL: https://github.com/nodejs/node/pull/52406
Fixes: https://github.com/nodejs/node/issues/52248
Reviewed-By: Yagiz Nizipli <yagiz.nizipli@sentry.io>
2024-04-17 05:30:05 +00:00
Tobias Nießen
d44814ca68
src: do not coerce dotenv paths
PR-URL: https://github.com/nodejs/node/pull/51425
Reviewed-By: Yagiz Nizipli <yagiz.nizipli@sentry.io>
Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
2024-01-12 15:42:34 +00:00
Ardi Nugraha
996d198101
src: return error --env-file if file is not found
PR-URL: https://github.com/nodejs/node/pull/50588
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
2023-11-14 04:05:57 +00:00
Yagiz Nizipli
ce30b4ea40
src: support multiple --env-file declarations
PR-URL: https://github.com/nodejs/node/pull/49542
Refs: https://github.com/nodejs/node/issues/49148
Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com>
Reviewed-By: Chemi Atlow <chemi@atlow.co.il>
2023-09-10 03:44:37 +00:00
Phil Nash
015e27bd08
src: don't overwrite environment from .env file
This commit adds a check to see if an environment variable that is
found in the .env file is already set in the environment. If it is,
then the value from the .env file is not used.

PR-URL: https://github.com/nodejs/node/pull/49424
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Chemi Atlow <chemi@atlow.co.il>
2023-09-08 06:44:36 +00:00
Yagiz Nizipli
769823e57c
src: add built-in .env file support
PR-URL: https://github.com/nodejs/node/pull/48890
Refs: https://github.com/orgs/nodejs/discussions/44975
Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Paolo Insogna <paolo@cowtech.it>
2023-08-17 14:08:05 +00:00