cloudsidedev / appside

Multitenant environment automation.
http://cloudside.ch
GNU Affero General Public License v3.0
38 stars 7 forks source link

Include domain or IP in bash prompt #40

Closed ocean90 closed 5 years ago

ocean90 commented 7 years ago
ocean90 commented 7 years ago
deploy@compute-01 ~ % cat .zshrc
# Set up the prompt

autoload -Uz promptinit
promptinit
prompt adam1

Checked some of the other themes, none of them are using \H for the host, which is the placeholder for the fully qualified domain name (or FQDN).

deploy@compute-01 ~ % hostname
compute-01
deploy@compute-01 ~ % hostname -f
compute-01.ch.example.ch
ivomarino commented 7 years ago

we should define a file in etc with some vars to source

ivomarino commented 7 years ago

code for this is here https://github.com/ttssdev/appflow/blob/master/playbooks/roles/common/tasks/main.yml#L87-L91, currently disabled.

ocean90 commented 7 years ago

Quote from GitLab.com Database Incident:

TODO after data restored:

  • Create issue to change terminal PS1 format/colours to make it clear whether you’re using production or staging (red production, yellow staging)
  • Show the full hostname in the bash prompt for all users by default (e.g., “db1.staging.gitlab.com” instead of just “db1”)
ivomarino commented 7 years ago

one idea is to leave hostname like it is:

user@compute-01

but change the color:

@ocean90 what do you think?

ocean90 commented 7 years ago

Would user@compute-01 [staging] (plus color) work too?

ivomarino commented 7 years ago

@ocean90 could be an option, basic idea is to keep the prompt as short as possible so maybe:

user@compute-01 [dev]
user@compute-01 [test]
user@compute-01 [stage]
user@compute-01 [prod]

I would suggest to start by grades, so first color, if we see it's not sufficient let's add also the suffix, ok?

ocean90 commented 7 years ago

Isn't it possible to disable or change colors? That's what I see in iTerm:

bildschirmfoto 2017-02-02 um 12 21 31

Colors are probably fine for the start but I always prefer text as it's more accessible. Don't forget that there are people with red–green color blindness. :)

ivomarino commented 7 years ago

True, also: http://serverfault.com/a/323155 ;)

ivomarino commented 5 years ago

For now I won't implement this, if someone would like to take it over feel free to open a pull request.