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.
Click to show internal directories.
Click to hide internal directories.