-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
29 lines (25 loc) · 748 Bytes
/
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
package main
import (
"fmt"
"log"
"os"
"github.com/aditmeno/registry-credential-helper/ecr"
"github.com/aditmeno/registry-credential-helper/gcr"
registryInterface "github.com/aditmeno/registry-credential-helper/interface"
)
func main() {
if os.Getenv("AWS_CLOUD_PROVIDER") != "" || os.Getenv("AWS_ACCESS_KEY_ID") != "" || os.Getenv("AWS_SDK_LOAD_CONFIG") != "" {
ecrHelper := ecr.GetECRCredentialHelper()
RegistryMain(ecrHelper)
} else if os.Getenv("GOOGLE_CLOUD_PROVIDER") != "" {
gcrHelper := gcr.GetGCRCredentialHelper()
RegistryMain(gcrHelper)
} else {
log.Fatal("Couldn't determine Cloud Provider!")
}
}
func RegistryMain(rh registryInterface.RegistryHelper) {
rh.Login()
token := rh.GetToken()
fmt.Println(token)
}