Skip to content

Conversation

nimish-ks
Copy link
Member

Added support for secret referencing across applications.

@rohan-chaturvedi you may use the following script to access secrets:

package main

import (
	"fmt"
	"log"

	"github.com/phasehq/golang-sdk/phase"
)

func main() {
	// Initialize the Phase client
	serviceToken := "pss_service:v2:..."
	host := "https://console.phase.dev"
	debug := true

	phaseClient := phase.Init(serviceToken, host, debug)
	if phaseClient == nil {
		log.Fatal("Failed to initialize Phase client")
	}

	// Define options for fetching secrets
	getOpts := phase.GetAllSecretsOptions{
		EnvName:    "Development",
		SecretPath: "/",
		AppID:      "443b1987-caaf-4b68-ab47-7cd49ef4ed74",
	}

	// Fetch secrets
	secrets, err := phaseClient.GetAll(getOpts)
	if err != nil {
		log.Fatalf("Failed to get secrets: %v", err)
	}

	// Print secrets in a readable format
	fmt.Println("Secrets:")
	for key, value := range secrets {
		fmt.Printf("%s: %s\n", key, value)
	}
}
  • Set the PHASE_SERVICE_TOKEN
  • Replace the app_id

@nimish-ks nimish-ks self-assigned this Mar 28, 2025
Copy link
Member

@rohan-chaturvedi rohan-chaturvedi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@nimish-ks nimish-ks merged commit a40db32 into main Apr 6, 2025
@nimish-ks nimish-ks deleted the feat--cross-app-secret-referencing branch April 6, 2025 09:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants