LoginSignup
0
0

More than 1 year has passed since last update.

node-configのlocal.json

Posted at

はじめに

node-configNODE_ENV の言うことを聞いてくれなくて困ったことがあったので記録しておく。

起こったこと

NODE_ENV の値は dev になってるのに、どうしてもlocal.jsonの値が読み込まれてしまう

原因

仕様だった。local.jsonとかlocal-xxx.yamlとかそういうのを設定ファイルに含めると、NODE_ENVの値に関係なく必ずそいつを読み込むらしい → https://github.com/node-config/node-config/issues/685

「この仕様のおかげで、ローカルではテスト通ってたのにプッシュしたらテスト通らない みたいなことがなくなるよ」などと言っている → https://github.com/node-config/node-config/wiki/Configuration-Files#local-files

おわりに

https://github.com/node-config/node-config/issues?q=local.json でissueのぞいてみたら同士がいっぱいいたけど、どれに対しても「バグじゃないよ、仕様だよ!wikiちゃんと読んでね」って返してるから変えるつもりはないんだろうなあ。

ちなみに、「NODE_ENV が設定されてなかった場合はdevelopment がデフォルト値として使われる」仕様も今回初めて知った。default.json じゃないのか。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0