MCPcopy Create free account
hub / github.com/Pluralith/pluralith-cli / SyncToBackend

Function SyncToBackend

app/pkg/backends/SyncToBackend.go:25–61  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

23}
24
25func SyncToBackend() error {
26 functionName := "PushDiagramToBackend"
27
28 backendConfig, backendErr := LoadBackendConfig()
29 if backendErr != nil {
30 return fmt.Errorf("could not load backend -> %v: %w", functionName, backendErr)
31 }
32
33 // Detect which backend is uses
34 if backendConfig.Backend.Type == "s3" {
35 if awsErr := PushToS3Backend(backendConfig); awsErr != nil {
36 return fmt.Errorf("failed to push to aws backend -> %v: %w", functionName, awsErr)
37 }
38 return nil
39 }
40 if backendConfig.Backend.Type == "azurerm" {
41 if azureErr := PushToAzureBackend(backendConfig); azureErr != nil {
42 return fmt.Errorf("failed to push to azure backend -> %v: %w", functionName, azureErr)
43 }
44 return nil
45 }
46 if backendConfig.Backend.Type == "gcs" {
47 if googleErr := PushToGCSBackend(backendConfig); googleErr != nil {
48 return fmt.Errorf("failed to push to gcs backend -> %v: %w", functionName, googleErr)
49 }
50 return nil
51 }
52
53 if backendConfig.Backend.Type != "" {
54 ux.PrintFormatted(" ✘", []string{"yellow", "bold"})
55 fmt.Print(" Backend type ")
56 ux.PrintFormatted(backendConfig.Backend.Type, []string{"white", "bold"})
57 fmt.Println(" isn't supported. Pluralith currently supports s3, gcs and azurerm.")
58 }
59
60 return nil
61}

Callers

nothing calls this directly

Calls 4

LoadBackendConfigFunction · 0.85
PushToS3BackendFunction · 0.85
PushToAzureBackendFunction · 0.85
PushToGCSBackendFunction · 0.85

Tested by

no test coverage detected