Thursday, September 30, 2021

CockroachDB TIL: Volume 2

This is a new series of articles covering short "Today I learned" topics as I peel the layers on CockroachDB. This is meant to resemble release notes. I decided to mix it up with the format for these posts as they may not justify an entire blog. Read Volume 1.

Topic 1 $COCKROACH_URL Environment Variable to Save Typing With Connection Strings

  1. Saves typing
  2. Can store password instead of passing in the prompt every time
  3. Pass additional session parameters instead of retyping them all the time

I find myself opening multiple command prompts and accessing the same cluster each time. $COCKROACH_URL is a handy trick to save myself time typing the connection string each time. Let's take CockroachDB Free Tier for example, it comes with a long connection string, which by the way also includes a password. One way to approach this is to save the connection string in an environment variable. The added benefit here is that password is stored with the variable and yes it is not secure but it's certainly better than typing the password out each time in clear text. It works similar to PGPASSWORD environment variable and yes it is not a best practice.



from DZone.com Feed https://ift.tt/3CZ4ayV

No comments:

Post a Comment