MCPcopy
hub / github.com/wavetermdev/waveterm / WriteAppSecretBindings

Function WriteAppSecretBindings

pkg/waveappstore/waveappstore.go:777–802  ·  view source on GitHub ↗
(appId string, bindings map[string]string)

Source from the content-addressed store, hash-verified

775}
776
777func WriteAppSecretBindings(appId string, bindings map[string]string) error {
778 if err := ValidateAppId(appId); err != nil {
779 return fmt.Errorf("invalid appId: %w", err)
780 }
781
782 appDir, err := GetAppDir(appId)
783 if err != nil {
784 return err
785 }
786
787 if bindings == nil {
788 bindings = make(map[string]string)
789 }
790
791 data, err := json.MarshalIndent(bindings, "", " ")
792 if err != nil {
793 return fmt.Errorf("failed to marshal bindings: %w", err)
794 }
795
796 bindingsPath := filepath.Join(appDir, SecretBindingsFileName)
797 if err := os.WriteFile(bindingsPath, data, 0644); err != nil {
798 return fmt.Errorf("failed to write %s: %w", SecretBindingsFileName, err)
799 }
800
801 return nil
802}
803
804func BuildAppSecretEnv(appId string, manifest *wshrpc.AppManifest, bindings map[string]string) (map[string]string, error) {
805 if manifest == nil {

Callers 1

Calls 3

ValidateAppIdFunction · 0.85
GetAppDirFunction · 0.85
WriteFileMethod · 0.80

Tested by

no test coverage detected