Skip to content

Commit

Permalink
env Update
Browse files Browse the repository at this point in the history
  • Loading branch information
Siddheshk02 committed Nov 27, 2023
1 parent 7817dc6 commit 4a3889e
Showing 1 changed file with 24 additions and 22 deletions.
46 changes: 24 additions & 22 deletions lib/init.go
Original file line number Diff line number Diff line change
@@ -1,48 +1,50 @@
package lib

import (
"log"
"os"

"github.com/joho/godotenv"
"github.com/pangeacyber/pangea-go/pangea-sdk/v2/pangea"
"github.com/pangeacyber/pangea-go/pangea-sdk/v2/service/authn"
"github.com/pangeacyber/pangea-go/pangea-sdk/v2/service/vault"
)

func Init() *authn.AuthN {
// err := godotenv.Load(".env")
// if err != nil {
// log.Fatal("\033[31m", "Error loading .env file", "\033[0m")
// }
err := godotenv.Load(".env")
if err != nil {
log.Fatal("\033[31m", "Error loading .env file", "\033[0m")
}
// Get token
// token := os.Getenv("PANGEA_AUTHN_TOKEN")
// if token == "" {
// log.Fatal("\033[31m", "Unauthorized: No token present", "\033[0m")
// }
token := "pts_xajlrac4we4mufoebqgejbrh2ieq72c4"
domain := "aws.us.pangea.cloud"
token := os.Getenv("PANGEA_AUTHN_TOKEN")
if token == "" {
log.Fatal("\033[31m", "Unauthorized: No token present", "\033[0m")
}

// Create config and client
client := authn.New(&pangea.Config{
Token: token,
Domain: domain,
Domain: os.Getenv("PANGEA_DOMAIN"),
})

return client
}

func InitVault() vault.Client {
// err := godotenv.Load(".env")
// if err != nil {
// log.Fatal("\033[31m", "Error loading .env file", "\033[0m")
// }
err := godotenv.Load(".env")
if err != nil {
log.Fatal("\033[31m", "Error loading .env file", "\033[0m")
}
// Get token
// token := os.Getenv("PANGEA_VAULT_TOKEN")
// if token == "" {
// log.Fatal("\033[31m", "Unauthorized: No token present", "\033[0m")
// }
token := "pts_xajlrac4we4mufoebqgejbrh2ieq72c4"
domain := "aws.us.pangea.cloud"
token := os.Getenv("PANGEA_VAULT_TOKEN")
if token == "" {
log.Fatal("\033[31m", "Unauthorized: No token present", "\033[0m")
}

// Create config and client
client := vault.New(&pangea.Config{
Token: token,
Domain: domain,
Domain: os.Getenv("PANGEA_DOMAIN"),
})

return client
Expand Down

0 comments on commit 4a3889e

Please sign in to comment.