- java.lang.Object
-
- org.github.gestalt.config.builder.SourceBuilder<GitConfigSourceBuilder,GitConfigSource>
-
- org.github.gestalt.config.git.GitConfigSourceBuilder
-
public final class GitConfigSourceBuilder extends org.github.gestalt.config.builder.SourceBuilder<GitConfigSourceBuilder,GitConfigSource>
Builder that allows you to construct a GitConfigSource.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description org.github.gestalt.config.source.ConfigSourcePackagebuild()Builds the GitConfigSource, The GitConfigSource will try and download the repo to the provided folder.static GitConfigSourceBuilderbuilder()Static function to create the builder.GitConfigSourceBuildersetBranch(java.lang.String branch)Set the branch you want to pull from git.GitConfigSourceBuildersetConfigFilePath(java.lang.String configFilePath)Set the path to the config file in the git repo.GitConfigSourceBuildersetCredentials(org.eclipse.jgit.transport.CredentialsProvider credentials)Set the credentials for the git config source.GitConfigSourceBuildersetLocalRepoDirectory(java.nio.file.Path localRepoDirectory)Set the local directory you want to save the git repo to.GitConfigSourceBuildersetRepoURI(java.lang.String repoURI)Set the URI to the git repo.GitConfigSourceBuildersetSshSessionFactory(org.eclipse.jgit.transport.SshSessionFactory sshSessionFactory)Setup the ssh session factory.
-
-
-
Method Detail
-
builder
public static GitConfigSourceBuilder builder()
Static function to create the builder.- Returns:
- the builder
-
setRepoURI
public GitConfigSourceBuilder setRepoURI(java.lang.String repoURI)
Set the URI to the git repo. Depending on your authentication method it can be either https or git or sshd.- Parameters:
repoURI- the URI to the git repo. Depending on your authentication method it can be either https or git or sshd- Returns:
- the builder
-
setLocalRepoDirectory
public GitConfigSourceBuilder setLocalRepoDirectory(java.nio.file.Path localRepoDirectory)
Set the local directory you want to save the git repo to.- Parameters:
localRepoDirectory- the local directory you want to save the git repo to.- Returns:
- the builder
-
setConfigFilePath
public GitConfigSourceBuilder setConfigFilePath(java.lang.String configFilePath)
Set the path to the config file in the git repo.- Parameters:
configFilePath- the path to the config file in the git repo- Returns:
- the builder
-
setBranch
public GitConfigSourceBuilder setBranch(java.lang.String branch)
Set the branch you want to pull from git.- Parameters:
branch- the branch you want to pull from git- Returns:
- the builder
-
setCredentials
public GitConfigSourceBuilder setCredentials(org.eclipse.jgit.transport.CredentialsProvider credentials)
Set the credentials for the git config source.- Parameters:
credentials- If authenticating with credentials, the CredentialsProvider such as UsernamePasswordCredentialsProvider- Returns:
- the builder
-
setSshSessionFactory
public GitConfigSourceBuilder setSshSessionFactory(org.eclipse.jgit.transport.SshSessionFactory sshSessionFactory)
Setup the ssh session factory.- Parameters:
sshSessionFactory- If using sshd the SshSessionFactory, this uses apache mina-sshd. The easiest way is to use the apache mina-sshd SshdSessionFactoryBuilder.- Returns:
- the builder
-
build
public org.github.gestalt.config.source.ConfigSourcePackage build() throws org.github.gestalt.config.exceptions.GestaltExceptionBuilds the GitConfigSource, The GitConfigSource will try and download the repo to the provided folder. So if there are any errors it will happen during construction.- Specified by:
buildin classorg.github.gestalt.config.builder.SourceBuilder<GitConfigSourceBuilder,GitConfigSource>- Returns:
- the built config source
- Throws:
org.github.gestalt.config.exceptions.GestaltException- any exceptions thrown while constructing the GitConfigSource.
-
-