Skip to content

Commit

Permalink
Merge pull request #33 from koudaiii/koudaiii/getenv
Browse files Browse the repository at this point in the history
[Fix bug] os.Getenv
  • Loading branch information
koudaiii authored Oct 18, 2017
2 parents cf1a1bf + e2ef4f9 commit 27cadcb
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 16 deletions.
5 changes: 4 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 0.6.3 (2017-10-18)

- [Fix bug] os.Getenv #33 #32

## 0.6.2 (2017-10-17)

- fix version v0.6.2 and fix link in READE #30 #29
Expand Down Expand Up @@ -25,4 +29,3 @@
## 0.2.0 (2017-01-18)

- list command

2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
NAME := qucli
VERSION := v0.6.2
VERSION := v0.6.3
REVISION := $(shell git rev-parse --short HEAD)

SRCS := $(shell find . -name '*.go' -type f)
Expand Down
9 changes: 4 additions & 5 deletions quay/notification.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package quay

import (
"encoding/json"
"os"
"path"

"github.com/koudaiii/qucli/utils"
Expand All @@ -16,7 +15,7 @@ func ListRepositoryNotifications(namespace string, name string, hostname string)

u.Path = path.Join(u.Path, "repository", namespace, name, "notification")

body, err := utils.HttpGet(u.String(), os.Getenv("QUAY_API_TOKEN"))
body, err := utils.HttpGet(u.String(), QuayAPIToken)
if err != nil {
return notifications, err
}
Expand Down Expand Up @@ -48,7 +47,7 @@ func DeleteRepositoryNotification(namespace string, name string, uuid string, ho

u.Path = path.Join(u.Path, "repository", namespace, name, "notification", uuid)

_, err := utils.HttpDelete(u.String(), os.Getenv("QUAY_API_TOKEN"))
_, err := utils.HttpDelete(u.String(), QuayAPIToken)
if err != nil {
return err
}
Expand All @@ -63,7 +62,7 @@ func AddRepositoryNotification(namespace string, name string, request RequestRep
u := QuayURLParse(hostname)
u.Path = path.Join(u.Path, "repository", namespace, name, "notification")

body, err := utils.HttpPost(u.String()+"/", os.Getenv("QUAY_API_TOKEN"), req)
body, err := utils.HttpPost(u.String()+"/", QuayAPIToken, req)
if err != nil {
return repos, err
}
Expand All @@ -80,7 +79,7 @@ func TestRepositoryNotification(namespace string, name string, uuid string, host

u.Path = path.Join(u.Path, "repository", namespace, name, "notification", uuid, "test")

_, err := utils.HttpPost(u.String(), os.Getenv("QUAY_API_TOKEN"), nil)
_, err := utils.HttpPost(u.String(), QuayAPIToken, nil)
if err != nil {
return err
}
Expand Down
7 changes: 3 additions & 4 deletions quay/permission.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package quay

import (
"encoding/json"
"os"
"path"

"github.com/koudaiii/qucli/utils"
Expand All @@ -15,7 +14,7 @@ func GetPermissions(namespace string, name string, accountType string, hostname
u := QuayURLParse(hostname)
u.Path = path.Join(u.Path, "repository", namespace, name, "permissions", accountType) + "/"

body, err := utils.HttpGet(u.String(), os.Getenv("QUAY_API_TOKEN"))
body, err := utils.HttpGet(u.String(), QuayAPIToken)
if err != nil {
return permissions, err
}
Expand All @@ -36,7 +35,7 @@ func DeletePermission(namespace string, name string, accountType string, account
u := QuayURLParse(hostname)
u.Path = path.Join(u.Path, "repository", namespace, name, "permissions", accountType, account)

_, err := utils.HttpDelete(u.String(), os.Getenv("QUAY_API_TOKEN"))
_, err := utils.HttpDelete(u.String(), QuayAPIToken)
if err != nil {
return err
}
Expand All @@ -53,7 +52,7 @@ func AddPermission(namespace string, name string, accountType string, account st
u := QuayURLParse(hostname)
u.Path = path.Join(u.Path, "repository", namespace, name, "permissions", accountType, account)

body, err := utils.HttpPut(u.String(), os.Getenv("QUAY_API_TOKEN"), req)
body, err := utils.HttpPut(u.String(), QuayAPIToken, req)
if err != nil {
return repos, err
}
Expand Down
2 changes: 2 additions & 0 deletions quay/quay.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,3 +93,5 @@ func QuayURLParse(hostname string) *url.URL {
}
return u
}

var QuayAPIToken = os.Getenv("QUAY_API_TOKEN")
9 changes: 4 additions & 5 deletions quay/repository.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package quay
import (
"encoding/json"
"net/url"
"os"
"path"
"strconv"

Expand All @@ -21,7 +20,7 @@ func ListRepository(namespace string, public bool, hostname string) (QuayReposit

u.Path = path.Join(u.Path, "repository")

body, err := utils.HttpGet(u.String()+"?"+values.Encode(), os.Getenv("QUAY_API_TOKEN"))
body, err := utils.HttpGet(u.String()+"?"+values.Encode(), QuayAPIToken)
if err != nil {
return repositories, err
}
Expand All @@ -46,7 +45,7 @@ func GetRepository(namespace string, name string, hostname string) (ResponseRepo
u := QuayURLParse(hostname)
u.Path = path.Join(u.Path, "repository", namespace, name)

body, err := utils.HttpGet(u.String(), os.Getenv("QUAY_API_TOKEN"))
body, err := utils.HttpGet(u.String(), QuayAPIToken)
if err != nil {
return repos, err
}
Expand All @@ -62,7 +61,7 @@ func DeleteRepository(namespace string, name string, hostname string) error {
u := QuayURLParse(hostname)
u.Path = path.Join(u.Path, "repository", namespace, name)

_, err := utils.HttpDelete(u.String(), os.Getenv("QUAY_API_TOKEN"))
_, err := utils.HttpDelete(u.String(), QuayAPIToken)
if err != nil {
return err
}
Expand All @@ -81,7 +80,7 @@ func CreateRepository(namespace string, name string, visibility string, hostname
u := QuayURLParse(hostname)
u.Path = path.Join(u.Path, "repository")

body, err := utils.HttpPost(u.String(), os.Getenv("QUAY_API_TOKEN"), req)
body, err := utils.HttpPost(u.String(), QuayAPIToken, req)
if err != nil {
return repos, err
}
Expand Down

0 comments on commit 27cadcb

Please sign in to comment.