From dd16b5bfefa6d5aac88f1104433f272392fe0aa3 Mon Sep 17 00:00:00 2001 From: Matt Vinall Date: Mon, 19 Mar 2018 15:18:01 +0000 Subject: [PATCH] add EnvVar to --registry switch (#81) (#82) allows people to setup default registry in .bashrc and avoid typing it every time --- README.md | 5 ++++- main.go | 7 ++++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 2f763e09..ccf98bd4 100644 --- a/README.md +++ b/README.md @@ -59,11 +59,14 @@ GLOBAL OPTIONS: --force-non-ssl, -f force allow use of non-ssl --username value, -u value username for the registry --password value, -p value password for the registry - --registry value, -r value URL to the private registry (ex. r.j3ss.co) (default: "https://registry-1.docker.io") + --registry value, -r value URL to the private registry (ex. r.j3ss.co) (default: "https://registry-1.docker.io") [$REG_REGISTRY] --help, -h show help --version, -v print the version ``` +Note that the `--registry` can be set by an environment variable `REG_REGISTRY`, so you can set this in your shell login scripts. +Specifying the registry on the command-line will override an environment variable setting. + ## Auth `reg` will automatically try to parse your docker config credentials, but if diff --git a/main.go b/main.go index 1110a740..6303dd86 100644 --- a/main.go +++ b/main.go @@ -48,9 +48,10 @@ func main() { Usage: "password for the registry", }, cli.StringFlag{ - Name: "registry, r", - Usage: "URL to the private registry (ex. r.j3ss.co)", - Value: repoutils.DefaultDockerRegistry, + Name: "registry, r", + Usage: "URL to the private registry (ex. r.j3ss.co)", + Value: repoutils.DefaultDockerRegistry, + EnvVar: "REG_REGISTRY", }, }