postgres-status-check

command
v0.0.0-...-9b2c7f4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 14, 2021 License: BSD-3-Clause Imports: 10 Imported by: 0

README

postgres-status-check CLI usage

The tool expects the following input information to function:

  • Name of the postgres service
  • Name of the namespace of the service
  • Name of the database
  • Database username
  • Database password

These values can be provided in three different ways:

As flags to the command

For eg, the following command can be used to check if a postgres service by name postgres-db in dev namespace with the corresponding credentials is responding:

$ postgres-status-check --service postgres-db --namespace  dev \
    --dbname prod_db --username admin   --password admin
# output

time="2021-06-29T16:53:05Z" level=info msg="Postgres db postgres\
of Service postgres in namespace default responded OK"

dbname(database name), username(database username), password (database password) and namespace are and will get default values. Look at the help of the command for details.

As environment variables

If no flags are provided, the tool looks for environment variables for getting the information. To avoid possible confusion, the environment variables has the prefix PSC. The usage can be as follows:

$ export PSC_DBNAME=postgres
$ export PSC_NAMESPACE=default
$ export PSC_PASSWORD=postgres
$ export PSC_SERVICE=postgres
$ export PSC_USERNAME=postgres

$ postgres-status-check

#output
time="2021-06-29T16:53:05Z" level=info msg="Postgres db postgres of \
Service postgres in namespace default responded OK"

As configuration file

If the tool couldn't find the values in the above two cases, it looks for a configuration file with the data. By default, it looks for the file $HOME/.postgres-status-check.yaml if a flag --config with the right file is not provided.

An example usage is:

$ cat /home/username/.config
dbname: postgres-db
namespace: dev
service: postgres-svc

$ postgres-status-check --config /home/username/.config
FATA[0000] services "postgres-svc" not found
exit status 1

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL