Customize IRB prompt to include env name#9585
Merged
zachmargolis merged 2 commits intomainfrom Nov 14, 2023
Merged
Conversation
changelog: Internal, Console, Update console prompt to include environment name
matthinz
approved these changes
Nov 13, 2023
soniaconnolly
approved these changes
Nov 13, 2023
|
|
||
| def on_deployed_box? | ||
| return @on_deployed_box if defined?(@on_deployed_box) | ||
| @on_deployed_box = File.directory?('/srv/idp/releases/') |
Contributor
There was a problem hiding this comment.
On some rollplans, I've seen cd /srv/idp/current. Is that a symbolic link to /srv/idp/releases? Is this a reliable way to tell that we're on a deployed box?
This was referenced Nov 14, 2023
Merged
aduth
reviewed
Nov 16, 2023
Comment on lines
+10
to
+12
| PROMPT_I: "%N(#{bold(env)}):%03n:%i> ", | ||
| PROMPT_S: "%N(\e[1m#{bold(env)}\e[22m):%03n:%i%l ", | ||
| PROMPT_C: "%N(\e[1m#{bold(env)}\e[22m):%03n:%i* ", |
Contributor
There was a problem hiding this comment.
Is it not possible to use Identity::Hostdata.env here?
Contributor
Author
There was a problem hiding this comment.
That requires bundler to be loaded, so this work with plain irb
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🎫 Ticket
Action item from incident review
🛠 Summary of changes
Updates IRB console (and Rails console) to include environment name, see screenshots below.
Note: local rails console uses Pry, which has its own prompt, see screenshots below that it does work in prod which uses plain IRB
Another option is coloring the text/background, but this seemed present and clear enough for the time being.
👀 Screenshots