gitsync

package
v0.5.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 18, 2026 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewFromGitConfig

func NewFromGitConfig(path string, gitConfig map[string]any, sourceName string, provider pkgsync.SecretProvider) (*gitsync.Synchronizer, error)

NewFromGitConfig creates a new Synchronizer for external users using a git configuration map. This is the recommended constructor for external projects integrating with this package.

The gitConfig map should contain the following fields:

  • "repo" (string, required): Git repository URL
  • "reference" (string, optional): Git branch or tag name (mutually exclusive with "commit")
  • "commit" (string, optional): Specific commit SHA to checkout (mutually exclusive with "reference")
  • "credential" (string, optional): Name of the credential to use for authentication

The secretProvider is required if credentials are needed. The provider will be called with the credential name to retrieve the actual credentials.

Example usage:

gitConfig := map[string]any{
    "repo":       "https://github.com/myorg/policies.git",
    "reference":  "main",
    "credential": "github-token",
}
provider := myorg.NewVaultSecretProvider(vaultClient)
syncer, err := gitsync.NewFromGitConfig("/path/to/clone", gitConfig, "my-source", provider)
if err != nil {
    log.Fatal(err)
}
err = syncer.Execute(ctx)

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL