console1984 icon indicating copy to clipboard operation
console1984 copied to clipboard

Add reason using environment variable

Open JDrizzy opened this issue 10 months ago • 0 comments

Redirecting long scripts to Heroku breaks due to the required input reason e.g.

# -- input
echo "puts 'hello'" > <local_directory_path>/test.rb
cat <local_directory_path>/test.rb | heroku run "CONSOLE_USER=Jarrad rails c" --no-tty
# -- output
Jarrad, why are you using this console today?
Loading production environment (Rails 7.2.2)
Switch to inspect mode.
# -- exits here without the redirected puts

Similar to CONSOLE_USER, I was wondering whether we could add another environment variable, CONSOLE_REASON for example, that supplies the reason value and skips the input e.g.

module Console1984::InputOutput
    private

   ....

    def ask_for_session_reason
      return ENV['CONSOLE_REASON'] if ENV['CONSOLE_REASON'].present?
      ...
    end
  end
end

If there's another way to solve this without any library changes that would be preferred! 🙏

JDrizzy avatar Feb 13 '25 03:02 JDrizzy