最近、コンテナ化や The Twelve-Factor App で環境変数を使う機会が多くなってきたので、一覧を作る方法が欲しくなった。 gemにする気力は今無いので、とりあえずコード片をブログに書いておく。*1 # config/application.rb の最後に以下のコードを貼ったら、それっぽく動いた。 module EnvLogger def self.histories @histories ||= [] end def [](key) EnvLogger.histories << key super end def fetch(key, default = nil) EnvLogger.histories << key super end end ENV.singleton_class.prepend EnvLogger at_exit do EnvLogger.histor