nodejs / nodejs/node

Support variable expansion in DotEnv features

オープン
#65,705 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

dotenv feature request
主要言語
JavaScript
スター
122k
フォーク
37.3k
平均マージ
4日 2時間
マージ済み PR(30日)
283

説明

What is the problem this feature will solve?

Sometimes it's helpful to derive the value of variables from other variables, using variable expansion.

For example, consider the following .env file:

APPLICATION_PORT: 8080
BASE_URL: http://localhost:8080

The APPLICATION_PORT and BASE_URL should have the same port. For reasons external to this issue, BASE_URL cannot be split into two variables without causing confusion.

If there are external overrides to APPLICATION_PORT, they won't remain in sync with BASE_URL.

What is the feature you are proposing to solve the problem?

Instead we could write .env files like this:

APPLICATION_PORT: 8080
BASE_URL: http://localhost:${APPLICATION_PORT}

This is already supported by at least bash, and the concept of variable expansion in environmental configuration is also common in ecosystems such as Kubernetes.

What alternatives have you considered?
  • Using dotenvx
  • Splitting variables up into their lowest common set

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

この issue ではファイルやテストが指定されていないため、まず Node の DotEnv 実装と既存のテストカバレッジを見つけます。値がどのようにパースされ解決されるかを追跡し、そのうえで ${APPLICATION_PORT} の展開と、上書きおよび順序に対して期待される動作のテストを定義します。提案された展開動作が実装され、テストでカバーされれば完了です。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
javascript
領域
backend
issue の種類
機能追加
難易度
4/5
見積もり時間
3〜5日
活発さ
活発
明瞭さ
おおむね明確
初心者へのやさしさ
52/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。