console

command
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Oct 1, 2019 License: MIT Imports: 7 Imported by: 0

README

Console Redis counter

Build Status

A console application implementing the rediscounter package. When it is run it will connect to Redis, increase the counter's value and display the result.

Redis connection options can be specified using different flags.

Building the command

  • install Golang or use the provided Vagrant project which includes also VMs with Redis and Vault.
  • download the package - go get github.com/slavrd/go-redis-counter
  • build the command - go build $(go env GOPATH)/src/github.com/slavrd/go-redis-counter/console

Running the command

The binary accepts the following options. All of them have defaults set so it can potentially be run without using any of them.

  • -a - the Redis server address. Default is localhost.
  • -p - the Redis server port. Default is 6379.
  • -d - the Redis server db id. Default is 0.
  • -k - the Redis server key in which to store the counter's value. Default is count.

There are two ways to specify the password for the Redis server (if needed):

  1. Pass it directly using the -pass command line flag. Default is "" which will result in connection without authentication.
  2. Retrieve it from a Vault server KV secrets engine. To use this option use -v-use flag.
    • Vault address must be set in VAULT_ADDR environment variable.
    • Vault access token must be set in VAULT_TOKEN environment variable.
    • -v-secret-path - sets the vault KV secret path. Default is kv/redispassword.
    • -v-secret-key - sets tha vault KV secret key. Default is pass.

Examples:

./console -a 192.168.0.1 -pass 'mypassword' will make the app connect to Redis @ 192.168.0.1:6379, db 0, key 'count' using password 'mypassword'.

./console -a 192.168.0.1 -v-use will make the app connect to Redis @ 192.168.0.1:6379, db 0, key 'count' using a password retrieved from Vault.

Documentation

Overview

Command console starts a console client that implements the rediscounter package. It will increment the counter value and display the result

Jump to

Keyboard shortcuts

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