# README
go-exercises-manager
The utility for managing users.
Features
- commands:
- add a user:
- parameters:
- username;
- password;
- password hashing cost;
- flag indicating the need to generate a password;
- generated password length;
- flag indicating whether the user is disabled or not;
- parameters:
- update a user:
- parameters:
- username;
- new username;
- password;
- password hashing cost;
- flag indicating the need to generate a password;
- generated password length;
- flag indicating whether the user is disabled or not;
- flag indicating whether the user is enabled or not;
- can update the user fields individually.
- parameters:
- add a user:
Installation
Prepare the directory:
$ mkdir --parents "$(go env GOPATH)/src/github.com/thewizardplusplus/"
$ cd "$(go env GOPATH)/src/github.com/thewizardplusplus/"
Clone this repository:
$ git clone https://github.com/thewizardplusplus/go-exercises-backend.git
$ cd go-exercises-backend
Install dependencies with the dep tool:
$ dep ensure -vendor-only
Build the utility:
$ go install ./cmd/go-exercises-manager
Usage
$ go-exercises-manager -h | --help
$ go-exercises-manager add-user [options]
$ go-exercises-manager update-user [options]
Commands:
add-user
— add the user;update-user
— update the user.
Options:
-h
,--help
— show the context-sensitive help message and exit;-u STRING
,--username STRING
— username;-U STRING
,--new-username STRING
— new username (applies only to theupdate-user
command);-p STRING
,--password STRING
— user password;-c INTEGER
,--cost INTEGER
— cost of the user password hashing (range: from 4 to 31 inclusive; default:10
);-g
,--generate
— generate the user password;-l INTEGER
,--length INTEGER
— length of the user password to be generated (minimum: 6; default:6
);-d
,--disable
— disable the user;-e
,--enable
— enable the user (applies only to theupdate-user
command).
Environment variables:
STORAGE_ADDRESS
— PostgreSQL connection URI (default:postgres://postgres:postgres@localhost:5432/postgres?sslmode=disable
).