basecamp / basecamp/console1984
Add reason using environment variable
- Dominant language
- Ruby
- Stars
- 844
- Forks
- 44
- PR merge metrics
- No merged PRs in 30d
Description
[Redirecting long scripts to Heroku](https://spin.atomicobject.com/rails-script-heroku/) breaks due to the required input reason e.g.
```shell
# -- input
echo "puts 'hello'" > /test.rb
cat /test.rb | heroku run "CONSOLE_USER=Jarrad rails c" --no-tty
```
```shell
# -- 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.
```Ruby
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! 🙏
Contributor guide
No contributing guide indexed for this repository
Research direction
Start at Console1984::InputOutput#ask_for_session_reason and inspect how the existing CONSOLE_USER environment variable is handled. Confirm the desired behavior for CONSOLE_REASON, including bypassing interactive input for redirected Heroku scripts, then run the relevant console input tests if present.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rails, ruby
- Domain
- cli, tooling
- Issue type
- Feature
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100