Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
Figaroなどの Gem やHerokuなどのサービスを使用すると、環境変数を使用して実行時に Rails アプリを構成できます。
アプリに必要な環境変数の存在を検証するにはどうすればよいですか?存在しない場合は起動に失敗しますか?
次のようなものをイニシャライザに入れることができます。
# config/initializers/check_env.rb fail "MY_ENV not defined" unless ENV["MY_VAR"]