LoginSignup
2
1

More than 5 years have passed since last update.

AzureWebAppsのスロットごとにNode.jsのconfig設定を使い分ける

Last updated at Posted at 2016-02-26

背景

  • デプロイスロットごとにテストのためにDB接続やメール設定を変えたい。
  • node-configを使って実現できそう。

準備

node-config

node-config自体の詳細はGithubを参照(https://github.com/lorenwest/node-config)
package.jsonのdependenciesにある状態で、azureにPushしてください。

npm install node-config --save

Azureの設定

  • NODE_ENV : default.json, staging.jsonなどの名前部分を設定します。
  • NODE_CONFIG_DIR : configファイルを置く場所を設定します。以下の例では"..\config"フォルダに格納されている**.jsonがNODE_ENVの値に応じて読み込まれます。

node-config.PNG

2
1
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
2
1