From e3f2a64515d77d19fe391bd4e16e87c1ca8976de Mon Sep 17 00:00:00 2001 From: Ubuntu Date: Tue, 24 Aug 2021 05:43:18 +0000 Subject: [PATCH 1/3] Added logic to get key and instance id from env and protecting the keys --- README.md | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 545ba7f8..08b76558 100644 --- a/README.md +++ b/README.md @@ -55,6 +55,11 @@ Use go build to add the SDK to your project's Go module dependencies. The SDK r go build ./... ``` +```sh +export API_KEY="Apikey from Servcie Crednetials" + +export RESOURCE_INSTANCE_ID="Resource Instance Id from Bucket Service Credentials" + ## Example code Create a file `main.go`, replacing your own values for API key, instance ID, and bucket name: @@ -64,6 +69,7 @@ package main import ( "fmt" + "os" "github.com/IBM/ibm-cos-sdk-go/aws" "github.com/IBM/ibm-cos-sdk-go/aws/credentials/ibmiam" @@ -71,9 +77,10 @@ import ( "github.com/IBM/ibm-cos-sdk-go/service/s3" ) + const ( - apiKey = "" - serviceInstanceID = "" + apiKey = os.Getenv("API_KEY") + serviceInstanceID = os.Getnev("RESOURCE_INSTANCE_ID") authEndpoint = "https://iam.cloud.ibm.com/identity/token" serviceEndpoint = "https://s3-api.us-geo.objectstorage.softlayer.net" ) From 2694d38f696135853bb096ef95e2312a755852b7 Mon Sep 17 00:00:00 2001 From: Ubuntu Date: Tue, 24 Aug 2021 05:45:36 +0000 Subject: [PATCH 2/3] Added logic to get key and instance id from env and protecting the keys --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 08b76558..3d6ed68c 100644 --- a/README.md +++ b/README.md @@ -59,7 +59,7 @@ go build ./... export API_KEY="Apikey from Servcie Crednetials" export RESOURCE_INSTANCE_ID="Resource Instance Id from Bucket Service Credentials" - +``` ## Example code Create a file `main.go`, replacing your own values for API key, instance ID, and bucket name: From f4f9d6295da9c5ac0e3a0bb4d59263af46d170fa Mon Sep 17 00:00:00 2001 From: Ubuntu Date: Tue, 24 Aug 2021 05:47:40 +0000 Subject: [PATCH 3/3] Added logic to get key and instance id from env and protecting the keys --- README.md | 1 - 1 file changed, 1 deletion(-) diff --git a/README.md b/README.md index 3d6ed68c..9fdf3f94 100644 --- a/README.md +++ b/README.md @@ -57,7 +57,6 @@ go build ./... ```sh export API_KEY="Apikey from Servcie Crednetials" - export RESOURCE_INSTANCE_ID="Resource Instance Id from Bucket Service Credentials" ``` ## Example code