Class GitConfigSourceBuilder


  • public final class GitConfigSourceBuilder
    extends org.github.gestalt.config.builder.SourceBuilder<GitConfigSourceBuilder,​GitConfigSource>
    Builder that allows you to construct a GitConfigSource.
    • Field Summary

      • Fields inherited from class org.github.gestalt.config.builder.SourceBuilder

        configReloadStrategies, source, tags
    • 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.GestaltException
        Builds 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:
        build in class org.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.